legacyEip712Encode method

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

Legacy EIP-712 encoding for numeric values (BigInt). Optionally keeps the size unchanged based on the keepSize parameter.

Implementation

@override
EncoderResult legacyEip712Encode(
    AbiParameter params, BigInt input, bool keepSize) {
  _ABIValidator.isValidNumber(params.type, input);
  final size = _ABIUtils.numericSize(params.type) ?? 32;
  return EncoderResult(
      isDynamic: false,
      encoded: BigintUtils.toBytes(input.toUnsigned(size * 8),
          length: keepSize ? 32 : size));
}