decodeEvent function

Future<DecodedEvent?> decodeEvent({
  1. required String messageBody,
  2. required String contractAbi,
  3. dynamic event,
})

Decode input data and return DecodedEvent or throws error

Implementation

Future<DecodedEvent?> decodeEvent({
  required String messageBody,
  required String contractAbi,
  MethodName? event,
}) async {
  final res = await createLib().decodeEvent(
    messageBody: messageBody,
    contractAbi: contractAbi,
    event: event == null ? null : jsonEncode(event),
  );
  final decoded = jsonDecode(res);
  if (decoded == null) return null;
  return DecodedEvent.fromJson(decoded);
}