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
2020-10-30 15:39:40 +01:00
committed by GitHub
parent 9026eee5d6
commit a5a6474025
2 changed files with 36 additions and 20 deletions
+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>,
},
}