signOffChain method
Implementation
Future<String> signOffChain(
String from,
String to,
BigInt value,
String data,
String nonce,
BigInt gasPrice,
BigInt gasLimit,
) async {
dynamic inputArr = [
'0x19',
'0x00',
from,
to,
hexZeroPad(hexlify(value), 32),
data,
nonce,
hexZeroPad(hexlify(gasPrice), 32),
hexZeroPad(hexlify(gasLimit), 32)
];
String input = '0x' +
inputArr.map((hexStr) => hexStr.toString().substring(2)).join('');
print('input: $input');
Uint8List hash = keccak256(hexToBytes(input));
print('hash: ${HEX.encode(hash)}');
print(
'signing on message with accountAddress: ${await _credentials.extractAddress()}');
Uint8List signature = await _credentials.signPersonalMessage(hash);
return '0x' + HEX.encode(signature);
}