2016-12-11 19:30:54 +01:00
|
|
|
// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
|
2016-05-02 12:17:30 +02:00
|
|
|
// 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/>.
|
|
|
|
|
|
|
|
//! Traces specific rpc interface.
|
|
|
|
use std::sync::Arc;
|
|
|
|
use jsonrpc_core::*;
|
|
|
|
|
|
|
|
/// Traces specific rpc interface.
|
|
|
|
pub trait Traces: Sized + Send + Sync + 'static {
|
|
|
|
/// Returns traces matching given filter.
|
2016-05-27 20:04:41 +02:00
|
|
|
fn filter(&self, _: Params) -> Result<Value, Error>;
|
2016-05-02 12:17:30 +02:00
|
|
|
|
|
|
|
/// Returns transaction trace at given index.
|
2016-05-27 20:04:41 +02:00
|
|
|
fn trace(&self, _: Params) -> Result<Value, Error>;
|
2016-05-02 12:17:30 +02:00
|
|
|
|
|
|
|
/// Returns all traces of given transaction.
|
2016-05-27 20:04:41 +02:00
|
|
|
fn transaction_traces(&self, _: Params) -> Result<Value, Error>;
|
2016-05-02 12:17:30 +02:00
|
|
|
|
|
|
|
/// Returns all traces produced at given block.
|
2016-05-27 20:04:41 +02:00
|
|
|
fn block_traces(&self, _: Params) -> Result<Value, Error>;
|
2016-05-02 12:17:30 +02:00
|
|
|
|
2016-06-02 16:30:28 +02:00
|
|
|
/// Executes the given call and returns a number of possible traces for it.
|
|
|
|
fn call(&self, _: Params) -> Result<Value, Error>;
|
2016-06-02 13:14:49 +02:00
|
|
|
|
2016-07-26 16:48:50 +02:00
|
|
|
/// Executes the given raw transaction and returns a number of possible traces for it.
|
|
|
|
fn raw_transaction(&self, _: Params) -> Result<Value, Error>;
|
|
|
|
|
2016-07-27 21:34:32 +02:00
|
|
|
/// Executes the transaction with the given hash and returns a number of possible traces for it.
|
|
|
|
fn replay_transaction(&self, _: Params) -> Result<Value, Error>;
|
|
|
|
|
2016-05-02 12:17:30 +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));
|
|
|
|
delegate.add_method("trace_filter", Traces::filter);
|
|
|
|
delegate.add_method("trace_get", Traces::trace);
|
|
|
|
delegate.add_method("trace_transaction", Traces::transaction_traces);
|
|
|
|
delegate.add_method("trace_block", Traces::block_traces);
|
2016-06-02 16:30:28 +02:00
|
|
|
delegate.add_method("trace_call", Traces::call);
|
2016-07-26 16:48:50 +02:00
|
|
|
delegate.add_method("trace_rawTransaction", Traces::raw_transaction);
|
2016-07-27 21:34:32 +02:00
|
|
|
delegate.add_method("trace_replayTransaction", Traces::replay_transaction);
|
2016-06-02 13:14:49 +02:00
|
|
|
|
2016-05-02 12:17:30 +02:00
|
|
|
delegate
|
|
|
|
}
|
|
|
|
}
|