restoreConnection method

  1. @override
Future<Map<String, Object?>> restoreConnection()
override

Attempts to restore a prior approval, returning the decoded ConnectEvent.

Returns a connect_error with code 100 when the wallet does not recognise the dApp. Unlike connect this needs no user gesture, which is why it is the right call on startup.

Implementation

@override
Future<Map<String, Object?>> restoreConnection() async {
  restoreCalls++;
  final failure = _takeFailure();
  if (failure != null) throw failure;
  return restoreResponse ?? (throw StateError('No restoreResponse set.'));
}