getMessageHash method
Gets the message hash for signing this authorization.
According to EIP-7702, the message to sign is: keccak256(MAGIC || chainId || address || nonce) where MAGIC = 0x05
Implementation
Uint8List getMessageHash() {
final magic = Uint8List.fromList([0x05]);
final chainIdBytes =
BytesUtils.bigIntToBytes(BigInt.from(chainId), length: 32);
final addressBytes = HexUtils.decode(address);
final nonceBytes = BytesUtils.bigIntToBytes(nonce, length: 32);
final message =
BytesUtils.concat([magic, chainIdBytes, addressBytes, nonceBytes]);
return Keccak256.hash(message);
}