decodeTransaction function

Future<DecodedTransaction?> decodeTransaction({
  1. required Transaction transaction,
  2. required String contractAbi,
  3. dynamic method,
})

Decode transaction and return DecodedTransaction or throws error

Implementation

Future<DecodedTransaction?> decodeTransaction({
  required Transaction transaction,
  required String contractAbi,
  MethodName? method,
}) async {
  final res = await createLib().decodeTransaction(
    transaction: jsonEncode(transaction),
    contractAbi: contractAbi,
    method: method == null ? null : jsonEncode(method),
  );
  final decoded = jsonDecode(res);
  if (decoded == null) return null;
  return DecodedTransaction.fromJson(decoded);
}