legacyEip712Encode method
Legacy EIP-712 encoding for tuple values.
Optionally keeps the size unchanged based on the keepSize
parameter.
Implementation
@override
EncoderResult legacyEip712Encode(
AbiParameter params, List<dynamic> input, bool keepSize) {
List<EncoderResult> encoded = [];
if (input.length != params.components.length) {
throw const SolidityAbiException("Invalid argument length detected.");
}
for (int i = 0; i < params.components.length; i++) {
final paramComponent = params.components[i];
EncoderResult result =
paramComponent.legacyEip712Encode(input[i], keepSize);
encoded.add(result);
}
final re = encoded.map((e) => e.encoded).toList();
return EncoderResult(
isDynamic: false, encoded: [for (var i in re) ...i], name: params.name);
}