getEip191Signature function

Future<Map<String, dynamic>> getEip191Signature(
  1. Wallet wallet,
  2. String message, {
  3. String version = 'v1',
})

Implementation

Future<Map<String, dynamic>> getEip191Signature(
  Wallet wallet,
  String message, {
  String version = 'v1',
}) async {
  if (wallet.signer == null) {
    log('This method is deprecated. Provide signer in the function');
    // sending random signature for making it backward compatible
    return {'signature': 'xyz', 'sigType': 'a'};
  }

  // EIP191 signature

  final signature = await wallet.signer?.getEip191Signature(message) ?? "";

  final sigType = version == 'v1' ? 'eip191' : 'eip191v2';
  return {'verificationProof': '$sigType:$signature'};
}