getSigningHash method
Compute the hash result to be signed. @param delegateFor "0x..." the address to delegate for him or null.
Implementation
Uint8List getSigningHash(String? delegateFor) {
// Get a unsigned Tx body as List
List<dynamic> unsignedTxBody = packUnsignedTxBody();
// RLP encode them to bytes.
Uint8List buff = Uint8List.fromList(rlp2.encode(unsignedTxBody));
// Hash it.
Uint8List h = blake2b256([buff]);
if (delegateFor != null) {
if (!Address.isAddress(delegateFor)) {
throw Exception("delegateFor should be address type.");
}
return blake2b256([h, hexToBytes(delegateFor.substring(2))]);
} else {
return h;
}
}