getApprovedEvents method

List<String>? getApprovedEvents({
  1. String? namespace,
})

Implementation

List<String>? getApprovedEvents({String? namespace}) {
  final eventsList = <String>[];

  if (sessionService.noSession) {
    return null;
  }
  if (sessionService.isCoinbase) {
    return eventsList;
  }
  if (sessionService.isMagic) {
    return eventsList;
  }

  final sessionNamespaces = _sessionData!.namespaces;
  if ((namespace ?? '').isEmpty) {
    for (var namespace in sessionNamespaces.keys) {
      final events = sessionNamespaces[namespace]?.events ?? [];
      eventsList.addAll(events);
    }

    return eventsList;
  }

  return sessionNamespaces[namespace]?.events ?? [];
}