Add an RPC method for calling a contract. (#3563)

* Sketch

* Some work on docs.

* Doc improvements.

* More docs.

* Some more docs.

* Yet another comment.

* Bump impl_version.

* Accept the block hash

* Use NumberOrHex

* Update node/rpc/src/contracts.rs

Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Move rpc/primitives
This commit is contained in:
Sergei Pepyakin
2019-09-12 13:30:10 +02:00
committed by GitHub
parent 294d172187
commit 4daac15d22
18 changed files with 279 additions and 27 deletions
+2 -10
View File
@@ -75,11 +75,12 @@ pub type ExecResult = Result<ExecReturnValue, ExecError>;
/// wrap the error string into an ExecutionError with the provided buffer and return from the
/// enclosing function. This macro is used instead of .map_err(..)? in order to avoid taking
/// ownership of buffer unless there is an error.
#[macro_export]
macro_rules! try_or_exec_error {
($e:expr, $buffer:expr) => {
match $e {
Ok(val) => val,
Err(reason) => return Err(ExecError { reason, buffer: $buffer }),
Err(reason) => return Err($crate::exec::ExecError { reason, buffer: $buffer }),
}
}
}
@@ -191,15 +192,6 @@ pub trait Loader<T: Trait> {
fn load_main(&self, code_hash: &CodeHash<T>) -> Result<Self::Executable, &'static str>;
}
/// Struct that records a request to deposit an event with a list of topics.
#[cfg_attr(any(feature = "std", test), derive(Debug, PartialEq, Eq))]
pub struct IndexedEvent<T: Trait> {
/// A list of topics this event will be deposited with.
pub topics: Vec<T::Hash>,
/// The event to deposit.
pub event: Event<T>,
}
/// A trait that represent a virtual machine.
///
/// You can view a virtual machine as something that takes code, an input data buffer,