encode method

  1. @override
List<int> encode({
  1. bool hash = true,
})
override

Encodes the typed data into a bytes, optionally hashing the result. If hash is true (default), the result is hashed using Keccak-256.

Implementation

@override
List<int> encode({bool hash = true}) {
  final List<int> encode = [
    ..._EIP712Utils.eip191PrefixBytes,
    ..._EIP712Utils.structHash(this, _EIP712Utils.domainKeyName, domain),
    ..._EIP712Utils.structHash(this, primaryType, message)
  ];
  if (hash) {
    return QuickCrypto.keccack256Hash(encode);
  }

  return encode;
}