update method

Implementation

@override
Future<EngineAcknowledged> update(SessionUpdateParams params) async {
  _isInitialized();
  await _isValidUpdate(params);
  final id = await _sendRequest<RequestSessionUpdate>(
    params.topic,
    JsonRpcMethod.WC_SESSION_UPDATE,
    RequestSessionUpdate(namespaces: params.namespaces),
    (v) => v.toJson(),
  );
  final completer = Completer<void>();
  final timer = completer.expirer();
  events.once(engineEvent(EngineEvent.SESSION_UPDATE, id), (data) {
    timer.cancel();
    if (data is ErrorResponse) {
      completer.completeError(data);
    } else {
      completer.complete();
    }
  });
  await client.session.update(
    params.topic,
    (session) => session.copyWith(namespaces: params.namespaces),
  );

  return EngineAcknowledged(acknowledged: completer.future);
}