isValidActions function

ErrorObject? isValidActions(
  1. dynamic namespace,
  2. String context
)

Implementation

ErrorObject? isValidActions(
  dynamic namespace,
  String context,
) {
  ErrorObject? error;
  if ((namespace is SessionBaseNamespace &&
          !isValidNamespaceMethodsOrEvents(namespace.methods)) ||
      (namespace is ProposalBaseRequiredNamespace &&
          !isValidNamespaceMethodsOrEvents(namespace.methods))) {
    error = getSdkError(
      SdkErrorKey.UNSUPPORTED_METHODS,
      context:
          '$context, methods should be an array of strings or empty array for no methods',
    );
  } else if ((namespace is SessionBaseNamespace &&
          !isValidNamespaceMethodsOrEvents(namespace.events)) ||
      (namespace is ProposalBaseRequiredNamespace &&
          !isValidNamespaceMethodsOrEvents(namespace.events))) {
    error = getSdkError(
      SdkErrorKey.UNSUPPORTED_EVENTS,
      context:
          '$context, events should be an array of strings or empty array for no events',
    );
  }

  return error;
}