import React from 'react';
import ReactDOM from 'react-dom/client';
import { MetaMaskProvider } from '@metamask/sdk-react';
import 'bootswatch/dist/slate/bootstrap.min.css';
import './App.css';
import {
  createBrowserRouter,
  RouterProvider,
} from 'react-router-dom';

import WebApp from './WebApp';
import Widget from './Widget';

const router = createBrowserRouter([
  {
    path: '/',
    element: <WebApp />,
  },
  {
    path: 'widget/',
    element: <Widget />,
  },
]);

ReactDOM.createRoot(document.getElementById('root')).render(
  <React.StrictMode>
    <MetaMaskProvider
      debug={false}
      sdkOptions={{
        dappMetadata: {
          name: 'DGF Prototype',
          url: window.location.href,
        },
        enableAnalytics: false,
        readonlyRPCMap: {
          '0x539': 'http://127.0.0.1:8545/',
        },
      }}
    >
      <RouterProvider router={router} />
    </MetaMaskProvider>
  </React.StrictMode>,
);
