2016-04-11 21:06:32 +02:00
|
|
|
// Copyright 2015, 2016 Ethcore (UK) Ltd.
|
|
|
|
// This file is part of Parity.
|
|
|
|
|
|
|
|
// Parity is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
|
|
|
// Parity is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
//! Ethcore-specific rpc interface.
|
|
|
|
use std::sync::Arc;
|
|
|
|
use jsonrpc_core::*;
|
|
|
|
|
|
|
|
/// Ethcore-specific rpc interface.
|
|
|
|
pub trait Ethcore: Sized + Send + Sync + 'static {
|
2016-04-13 00:04:40 +02:00
|
|
|
|
2016-04-18 23:13:38 +02:00
|
|
|
/// Returns current transactions limit.
|
2016-05-27 20:04:41 +02:00
|
|
|
fn transactions_limit(&self, _: Params) -> Result<Value, Error>;
|
2016-04-18 23:13:38 +02:00
|
|
|
|
2016-04-11 21:06:32 +02:00
|
|
|
/// Returns mining extra data.
|
2016-05-27 20:04:41 +02:00
|
|
|
fn extra_data(&self, _: Params) -> Result<Value, Error>;
|
2016-04-11 21:06:32 +02:00
|
|
|
|
|
|
|
/// Returns mining gas floor target.
|
2016-05-27 20:04:41 +02:00
|
|
|
fn gas_floor_target(&self, _: Params) -> Result<Value, Error>;
|
2016-04-11 21:06:32 +02:00
|
|
|
|
2016-06-23 14:29:16 +02:00
|
|
|
/// Returns mining gas floor cap.
|
|
|
|
fn gas_ceil_target(&self, _: Params) -> Result<Value, Error>;
|
|
|
|
|
2016-04-13 00:04:40 +02:00
|
|
|
/// Returns minimal gas price for transaction to be included in queue.
|
2016-05-27 20:04:41 +02:00
|
|
|
fn min_gas_price(&self, _: Params) -> Result<Value, Error>;
|
2016-04-13 00:04:40 +02:00
|
|
|
|
2016-04-19 09:58:26 +02:00
|
|
|
/// Returns latest logs
|
2016-05-27 20:04:41 +02:00
|
|
|
fn dev_logs(&self, _: Params) -> Result<Value, Error>;
|
2016-04-19 09:58:26 +02:00
|
|
|
|
|
|
|
/// Returns logs levels
|
2016-05-27 20:04:41 +02:00
|
|
|
fn dev_logs_levels(&self, _: Params) -> Result<Value, Error>;
|
2016-04-19 09:58:26 +02:00
|
|
|
|
2016-04-21 19:19:42 +02:00
|
|
|
/// Returns chain name
|
2016-05-27 20:04:41 +02:00
|
|
|
fn net_chain(&self, _: Params) -> Result<Value, Error>;
|
2016-04-21 19:19:42 +02:00
|
|
|
|
|
|
|
/// Returns max peers
|
2016-05-27 20:04:41 +02:00
|
|
|
fn net_max_peers(&self, _: Params) -> Result<Value, Error>;
|
2016-04-21 19:19:42 +02:00
|
|
|
|
|
|
|
/// Returns network port
|
2016-05-27 20:04:41 +02:00
|
|
|
fn net_port(&self, _: Params) -> Result<Value, Error>;
|
2016-04-21 19:19:42 +02:00
|
|
|
|
|
|
|
/// Returns rpc settings
|
2016-05-27 20:04:41 +02:00
|
|
|
fn rpc_settings(&self, _: Params) -> Result<Value, Error>;
|
2016-04-21 19:19:42 +02:00
|
|
|
|
|
|
|
/// Returns node name
|
2016-05-27 20:04:41 +02:00
|
|
|
fn node_name(&self, _: Params) -> Result<Value, Error>;
|
2016-04-21 19:19:42 +02:00
|
|
|
|
2016-05-02 16:12:01 +02:00
|
|
|
/// Returns default extra data
|
2016-05-27 20:04:41 +02:00
|
|
|
fn default_extra_data(&self, _: Params) -> Result<Value, Error>;
|
2016-05-02 16:12:01 +02:00
|
|
|
|
2016-06-16 12:44:08 +02:00
|
|
|
/// Returns distribution of gas price in latest blocks.
|
|
|
|
fn gas_price_statistics(&self, _: Params) -> Result<Value, Error>;
|
|
|
|
|
2016-06-21 14:55:25 +02:00
|
|
|
/// Returns number of unsigned transactions waiting in the signer queue (if signer enabled)
|
|
|
|
/// Returns error when signer is disabled
|
|
|
|
fn unsigned_transactions_count(&self, _: Params) -> Result<Value, Error>;
|
|
|
|
|
2016-04-11 21:06:32 +02:00
|
|
|
/// Should be used to convert object to io delegate.
|
|
|
|
fn to_delegate(self) -> IoDelegate<Self> {
|
|
|
|
let mut delegate = IoDelegate::new(Arc::new(self));
|
2016-04-13 00:04:40 +02:00
|
|
|
|
2016-04-11 21:06:32 +02:00
|
|
|
delegate.add_method("ethcore_extraData", Ethcore::extra_data);
|
|
|
|
delegate.add_method("ethcore_gasFloorTarget", Ethcore::gas_floor_target);
|
2016-06-23 14:29:16 +02:00
|
|
|
delegate.add_method("ethcore_gasCeilTarget", Ethcore::gas_ceil_target);
|
2016-04-13 00:04:40 +02:00
|
|
|
delegate.add_method("ethcore_minGasPrice", Ethcore::min_gas_price);
|
2016-04-18 23:13:38 +02:00
|
|
|
delegate.add_method("ethcore_transactionsLimit", Ethcore::transactions_limit);
|
2016-04-19 09:58:26 +02:00
|
|
|
delegate.add_method("ethcore_devLogs", Ethcore::dev_logs);
|
|
|
|
delegate.add_method("ethcore_devLogsLevels", Ethcore::dev_logs_levels);
|
2016-04-21 19:19:42 +02:00
|
|
|
delegate.add_method("ethcore_netChain", Ethcore::net_chain);
|
|
|
|
delegate.add_method("ethcore_netMaxPeers", Ethcore::net_max_peers);
|
|
|
|
delegate.add_method("ethcore_netPort", Ethcore::net_port);
|
|
|
|
delegate.add_method("ethcore_rpcSettings", Ethcore::rpc_settings);
|
|
|
|
delegate.add_method("ethcore_nodeName", Ethcore::node_name);
|
2016-05-02 16:12:01 +02:00
|
|
|
delegate.add_method("ethcore_defaultExtraData", Ethcore::default_extra_data);
|
2016-06-16 12:44:08 +02:00
|
|
|
delegate.add_method("ethcore_gasPriceStatistics", Ethcore::gas_price_statistics);
|
2016-06-21 14:55:25 +02:00
|
|
|
delegate.add_method("ethcore_unsignedTransactionsCount", Ethcore::unsigned_transactions_count);
|
2016-04-19 19:38:41 +02:00
|
|
|
|
2016-04-11 21:06:32 +02:00
|
|
|
delegate
|
|
|
|
}
|
|
|
|
}
|