contracts: Rework contracts_call RPC (#7468)

* Implement serde::Deserialize for DispatchError if std

This is needed to use this type in the contracts RPC.

* contracts: Change contract_call RPC to return more information
This commit is contained in:
Alexander Theißen authored and GitHub committed 2020-10-30 14:39:40 +00:00
1 parent 9026eee5d6
commit a5a6474025
2 files changed
+36 -20

No files matched your search

+3 -2
View File
@@ -388,10 +388,10 @@ pub type DispatchResultWithInfo<T> = sp_std::result::Result<T, DispatchErrorWith
/// Reason why a dispatch call failed.
#[derive(Eq, PartialEq, Clone, Copy, Encode, Decode, RuntimeDebug)]
#[cfg_attr(feature = "std", derive(Serialize))]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
pub enum DispatchError {
/// Some error occurred.
Other(#[codec(skip)] &'static str),
Other(#[codec(skip)] #[cfg_attr(feature = "std", serde(skip_deserializing))] &'static str),
/// Failed to lookup some data.
CannotLookup,
/// A bad origin.
@@ -404,6 +404,7 @@ pub enum DispatchError {
error: u8,
/// Optional error message.
#[codec(skip)]
#[cfg_attr(feature = "std", serde(skip_deserializing))]
message: Option<&'static str>,
},
}