isValidExtension function

ErrorObject? isValidExtension(
  1. dynamic namespace,
  2. String method
)

Implementation

ErrorObject? isValidExtension(
  dynamic namespace,
  String method,
) {
  if (namespace.extension != null) {
    if ((namespace is SessionNamespace && (namespace.extension!.isEmpty)) ||
        (namespace is ProposalRequiredNamespace &&
            (namespace.extension!.isEmpty))) {
      final error = getInternalError(
        InternalErrorKey.MISSING_OR_INVALID,
        context:
            '$method extension should be an array of namespaces, or omitted',
      );
      return ErrorObject(message: error.message, code: error.code);
    }
  }

  return null;
}