decodeReturnValues method

List decodeReturnValues(
  1. String data
)

Uses the known types of the function output to decode the value returned by a contract after making an call to it.

The type of what this function returns is thus dependent from what it outputs are. For the conversions between dart types and solidity types, see the documentation for encodeCall.

Implementation

List<dynamic> decodeReturnValues(String data) {
  final tuple = TupleType(outputs.map((p) => p.type).toList());
  final buffer = hexToBytes(data).buffer;

  final parsedData = tuple.decode(buffer, 0);
  return parsedData.data;
}