executeChain<T> method

Future<Map<String, ParallelEventsRequestResponse>> executeChain<T>({
  1. required ParallelRequest<T> rootRequest,
  2. List<NostrEvent>? initialEvents,
})

Executes a parallel request chain starting from the given root request.

rootRequest - The first step in the parallel request chain initialEvents - Optional initial events to pass to the first step

Returns a map containing all results from each step in the chain.

Implementation

Future<Map<String, ParallelEventsRequestResponse>> executeChain<T>({
  required ParallelRequest<T> rootRequest,
  List<NostrEvent>? initialEvents,
}) async {
  final results = <String, ParallelEventsRequestResponse>{};

  await _executeStep<T>(
    request: rootRequest,
    previousResults: initialEvents ?? [],
    results: results,
  );

  return results;
}