legacyEip712Encode method

  1. @override
EncoderResult legacyEip712Encode(
  1. AbiParameter params,
  2. bool input,
  3. bool keepSize
)
override

Legacy EIP-712 encoding for boolean values. Optionally keeps the size unchanged based on the keepSize parameter.

Implementation

@override
EncoderResult legacyEip712Encode(
    AbiParameter params, bool input, bool keepSize) {
  if (keepSize) {
    return abiEncode(params, input);
  }
  final bytes = List<int>.filled(1, 0);
  bytes[0] = input ? 1 : 0;
  return EncoderResult(isDynamic: false, encoded: bytes);
}