abiOutputToReturnType function
- List<
FunctionParameter> outputs
Convert List<FunctionParameter>
to a dart source code fragment of the equivalent web3dart return type (using TupleX where necessary).
Implementation
String abiOutputToReturnType(List<FunctionParameter> outputs) {
if (outputs.isEmpty) return 'void';
if (outputs.length == 1) {
return web3TypesToDart(outputs.first.type.runtimeType.toString());
} else if (outputs.length > 20) {
throw Exception(
"abiOutputToReturnType can't handle more than 20 return types.");
}
return [
'Tuple${outputs.length}<',
outputs
.map((o) => web3TypesToDart(o.type.runtimeType.toString()))
.join(', '),
'>',
].join('');
}