import { type FC, type PropsWithChildren } from 'react';
import { ChainType } from '../../../utils/chainType.js';
import { isItemAllowed } from '../../../utils/item.js';
import { MVMBaseProvider } from './MVMBaseProvider.js';
import { useWidgetConfig } from '../../WidgetProvider/WidgetProvider.js';

export const MVMProvider: FC<PropsWithChildren> = ({ children }) => {
  const { chains } = useWidgetConfig();
  const isAllowMVM = isItemAllowed(ChainType.MVM, chains?.types);

  return isAllowMVM ? (
    <MVMBaseProvider>{children}</MVMBaseProvider>
  ) : (
    <>{children}</>
  );
};
