personalUnlockAccount method

Future<bool> personalUnlockAccount(
  1. EthereumAddress? address,
  2. String? passphrase, [
  3. int duration = 300
])

Decrypts the key with the given address from the key store. The unencrypted key will be held in memory until the unlock duration expires. The unlock duration defaults to 300 seconds. An explicit duration of zero seconds unlocks the key until geth exits. The account can be used with eth_sign and eth_sendTransaction while it is unlocked.

Implementation

Future<bool> personalUnlockAccount(
    EthereumAddress? address, String? passphrase,
    [int duration = 300]) async {
  if (address == null) {
    throw ArgumentError.notNull('Ethereum::personalUnlockAccount - address');
  }
  if (passphrase == null) {
    throw ArgumentError.notNull(
        'Ethereum::personalUnlockAccount - passphrase');
  }
  final paramDuration = duration;
  const method = EthereumRpcMethods.unlockAccount;
  final params = <dynamic>[address.asString, passphrase, paramDuration];
  final dynamic res = await _client.rpcClient.request(method, params);
  if (res != null && res.containsKey(EthereumConstants.ethResultKey)) {
    return true;
  }
  _client.processError(method, res);
  return false;
}