@@ -1009,6 +1009,7 @@ impl TryFromValue for EthereumContractAbiEntity {
1009
1009
pub struct EthereumBlockHandlerEntity {
1010
1010
pub handler : String ,
1011
1011
pub filter : Option < EthereumBlockHandlerFilterEntity > ,
1012
+ pub input : EthereumBlockHandlerData ,
1012
1013
}
1013
1014
1014
1015
impl WriteOperations for EthereumBlockHandlerEntity {
@@ -1025,6 +1026,7 @@ impl WriteOperations for EthereumBlockHandlerEntity {
1025
1026
if let Some ( filter_id) = filter_id {
1026
1027
entity. set ( "filter" , filter_id) ;
1027
1028
}
1029
+ entity. set ( "data" , String :: from ( self . input ) ) ;
1028
1030
ops. add ( Self :: TYPENAME , id. to_owned ( ) , entity) ;
1029
1031
}
1030
1032
}
@@ -1048,6 +1050,7 @@ impl From<super::MappingBlockHandler> for EthereumBlockHandlerEntity {
1048
1050
EthereumBlockHandlerEntity {
1049
1051
handler : block_handler. handler ,
1050
1052
filter,
1053
+ input : EthereumBlockHandlerData :: from ( block_handler. input ) ,
1051
1054
}
1052
1055
}
1053
1056
}
@@ -1065,6 +1068,7 @@ impl TryFromValue for EthereumBlockHandlerEntity {
1065
1068
Ok ( EthereumBlockHandlerEntity {
1066
1069
handler : map. get_required ( "handler" ) ?,
1067
1070
filter : map. get_optional ( "filter" ) ?,
1071
+ input : map. get_optional ( "input" ) ?. unwrap_or_default ( ) ,
1068
1072
} )
1069
1073
}
1070
1074
}
@@ -1106,6 +1110,69 @@ impl TryFromValue for EthereumBlockHandlerFilterEntity {
1106
1110
}
1107
1111
}
1108
1112
1113
+ #[ derive( Debug , PartialEq ) ]
1114
+ pub enum EthereumBlockHandlerData {
1115
+ Block ,
1116
+ FullBlock ,
1117
+ }
1118
+
1119
+ impl Default for EthereumBlockHandlerData {
1120
+ fn default ( ) -> EthereumBlockHandlerData {
1121
+ EthereumBlockHandlerData :: Block
1122
+ }
1123
+ }
1124
+
1125
+ impl FromStr for EthereumBlockHandlerData {
1126
+ type Err = Error ;
1127
+
1128
+ fn from_str ( s : & str ) -> Result < EthereumBlockHandlerData , Error > {
1129
+ match s {
1130
+ "FullBlock" => Ok ( EthereumBlockHandlerData :: FullBlock ) ,
1131
+ "Block" => Ok ( EthereumBlockHandlerData :: Block ) ,
1132
+ _ => Err ( format_err ! (
1133
+ "failed to parse `{}` as EthereumBlockHandlerData" ,
1134
+ s
1135
+ ) ) ,
1136
+ }
1137
+ }
1138
+ }
1139
+
1140
+ impl From < EthereumBlockHandlerData > for String {
1141
+ fn from ( data : EthereumBlockHandlerData ) -> String {
1142
+ match data {
1143
+ EthereumBlockHandlerData :: FullBlock => "FullBlock" . into ( ) ,
1144
+ EthereumBlockHandlerData :: Block => "Block" . into ( ) ,
1145
+ }
1146
+ }
1147
+ }
1148
+
1149
+ impl From < super :: BlockHandlerData > for EthereumBlockHandlerData {
1150
+ fn from ( data : BlockHandlerData ) -> Self {
1151
+ match data {
1152
+ BlockHandlerData :: FullBlock => EthereumBlockHandlerData :: FullBlock ,
1153
+ _ => EthereumBlockHandlerData :: Block ,
1154
+ }
1155
+ }
1156
+ }
1157
+
1158
+ impl From < EthereumBlockHandlerData > for q:: Value {
1159
+ fn from ( data : EthereumBlockHandlerData ) -> q:: Value {
1160
+ q:: Value :: Enum ( data. into ( ) )
1161
+ }
1162
+ }
1163
+
1164
+ impl TryFromValue for EthereumBlockHandlerData {
1165
+ fn try_from_value ( value : & q:: Value ) -> Result < EthereumBlockHandlerData , Error > {
1166
+ match value {
1167
+ q:: Value :: Enum ( data) => EthereumBlockHandlerData :: from_str ( data) ,
1168
+ _ => Err ( format_err ! (
1169
+ "cannot parse value as EthereumBlockHandlerData: `{:?}`" ,
1170
+ value
1171
+ ) ) ,
1172
+ }
1173
+ }
1174
+ }
1175
+
1109
1176
#[ derive( Debug ) ]
1110
1177
pub struct EthereumCallHandlerEntity {
1111
1178
pub function : String ,
0 commit comments