isValidNamespacesRequest static method
Validates the provided chainId, then gets the methods for that chainId and ensures that the method request is contained in the methods
Implementation
static bool isValidNamespacesRequest({
  required Map<String, Namespace> namespaces,
  required String chainId,
  required String method,
}) {
  // Validate the chainId
  if (!NamespaceUtils.isValidChainId(chainId)) {
    throw Errors.getSdkError(
      Errors.UNSUPPORTED_CHAINS,
      context: 'chain $chainId should conform to "CAIP-2" format',
    ).toSignError();
  }
  // Validate the namespaces
  isValidNamespaces(
    namespaces: namespaces,
    context: 'isValidNamespacesRequest',
  );
  List<dynamic> methods = NamespaceUtils.getNamespacesMethodsForChainId(
    namespaces: namespaces,
    chainId: chainId,
  );
  if (!methods.contains(method)) {
    throw Errors.getSdkError(
      Errors.UNSUPPORTED_METHODS,
      context: 'The method $method is not supported',
    ).toSignError();
  }
  return true;
}