3022ae9a6a
* style: fund account font size adjustments * client instance. contract addresses updates. prices hook added * persist lend assets value for every credit account * feat: account stats and semi circular progress * minor code cleanup * display borrowed assets interest rate * fallback screen when no wallet is connected * fix: hydration mismatch * update osmosis testnet endpoints * style: body text color * coin interface imported from cosmos package * risk calculation from ltv assets comment added * svgr setup. inline svg extracted to Icons folder * address removed from local storage. wallet store improvements * rename setAddress action to connect * yield page renamed to earn * refactor: accountStats using BigNumber * update contract addresses * update hardcoded fee * update market mocked values * current leverage added to useAccountStats hook return * leverage naming disambiguation * debt positions labels color update. negative sign before values * remove prefers-color-scheme media query * update redbank mock data
59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
import { useEffect } from 'react'
|
|
import type { AppProps } from 'next/app'
|
|
import Head from 'next/head'
|
|
import { ToastContainer, Zoom } from 'react-toastify'
|
|
import 'react-toastify/dist/ReactToastify.min.css'
|
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
import detectEthereumProvider from '@metamask/detect-provider'
|
|
|
|
import '../styles/globals.css'
|
|
import Layout from 'components/Layout'
|
|
import useWalletStore from 'stores/useWalletStore'
|
|
|
|
async function isMetamaskInstalled(): Promise<boolean> {
|
|
const provider = await detectEthereumProvider()
|
|
|
|
return !!provider
|
|
}
|
|
|
|
const queryClient = new QueryClient()
|
|
|
|
function MyApp({ Component, pageProps }: AppProps) {
|
|
const address = useWalletStore((s) => s.address)
|
|
const actions = useWalletStore((s) => s.actions)
|
|
|
|
// init store
|
|
useEffect(() => {
|
|
const verifyMetamask = async () => {
|
|
actions.setMetamaskInstalledStatus(await isMetamaskInstalled())
|
|
}
|
|
|
|
actions.initialize()
|
|
|
|
verifyMetamask()
|
|
}, [actions])
|
|
|
|
return (
|
|
<>
|
|
<Head>
|
|
<title>Mars V2</title>
|
|
{/* <meta name="description" content="Generated by create next app" /> */}
|
|
<link rel="icon" href="/favicon.svg" />
|
|
</Head>
|
|
<QueryClientProvider client={queryClient}>
|
|
<Layout>{address ? <Component {...pageProps} /> : <div>No wallet connected</div>}</Layout>
|
|
<ToastContainer
|
|
autoClose={1500}
|
|
closeButton={false}
|
|
position="bottom-right"
|
|
hideProgressBar
|
|
newestOnTop
|
|
transition={Zoom}
|
|
/>
|
|
</QueryClientProvider>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default MyApp
|