isValidNamespaceActions function

ErrorObject? isValidNamespaceActions(
  1. dynamic input,
  2. String method
)

Implementation

ErrorObject? isValidNamespaceActions(
  dynamic input,
  String method,
) {
  ErrorObject? error;
  if (input is SessionNamespaces || input is ProposalRequiredNamespaces) {
    input.values.forEach((namespace) {
      if (error != null) return;
      final validActionsError = isValidActions(namespace, '$method, namespace');
      final validExtensionError = isValidExtension(namespace, method);
      if (validActionsError != null) {
        error = validActionsError;
      } else if (validExtensionError != null) {
        error = validExtensionError;
      } else if (namespace.extension != null) {
        namespace.extension!.forEach((value) {
          if (error != null) return;
          final validActionsError = isValidActions(value, '$method, extension');
          if (validActionsError != null) {
            error = validActionsError;
          }
        });
      }
    });
  }

  return error;
}