Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
refactor everything
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev committed Jul 4, 2024
1 parent 69ab65d commit 542ccb2
Show file tree
Hide file tree
Showing 20 changed files with 577 additions and 1,068 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ the [ZetaChain Toolkit](https://github.com/zeta-chain/toolkit/).
- Omnichain swaps
- Token deposit and withdrawal
- Cross-chain transaction tracking
- Cross-chain messaging example
- Bitcoin support

## Prerequisites
Expand All @@ -25,8 +24,8 @@ the [ZetaChain Toolkit](https://github.com/zeta-chain/toolkit/).
- Yarn

The ZetaChain Toolkit is initialized with a custom RPC endpoint for ZetaChain to
ensure that requests are not rate-limited. By default we're using an RPC endpoint
provided by [AllThatNode](https://www.allthatnode.com/zetachain.dsrv).
ensure that requests are not rate-limited. By default we're using an RPC
endpoint provided by [AllThatNode](https://www.allthatnode.com/zetachain.dsrv).

Before starting the development server:

Expand Down
62 changes: 50 additions & 12 deletions app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
"use client"

import { AppProvider } from "@/context/AppContext"
import React, { createContext, useContext, useEffect, useState } from "react"
import { BalanceProvider } from "@/context/BalanceContext"
import { CCTXsProvider } from "@/context/CCTXsContext"
import { FeesProvider } from "@/context/FeesContext"
import { PricesProvider } from "@/context/PricesContext"
import { StakingProvider } from "@/context/StakingContext"
import { ValidatorsProvider } from "@/context/ValidatorsContext"
// @ts-ignore
import Cookies from "js-cookie"

import { Toaster } from "@/components/ui/toaster"
import { useToast } from "@/components/ui/use-toast"
import { SiteHeader } from "@/components/site-header"
import { ThemeProvider } from "@/components/theme-provider"

Expand All @@ -13,17 +22,46 @@ interface RootLayoutProps {
}

export default function Index({ children }: RootLayoutProps) {
const { toast } = useToast()

useEffect(() => {
if (!Cookies.get("firstTimeVisit")) {
toast({
title: "Welcome to ZetaChain Example App",
description: "This is a testnet. Please do not use real funds.",
duration: 60000,
})
Cookies.set("firstTimeVisit", "true", { expires: 7 })
}
}, [])

return (
<AppProvider>
<ThemeProvider attribute="class" defaultTheme="light" enableSystem>
<NFTProvider>
<div className="relative flex min-h-screen flex-col">
<SiteHeader />
<section className="container px-4 mt-4">{children}</section>
</div>
<Toaster />
</NFTProvider>
</ThemeProvider>
</AppProvider>
<BalanceProvider>
<FeesProvider>
<ValidatorsProvider>
<StakingProvider>
<PricesProvider>
<CCTXsProvider>
<ThemeProvider
attribute="class"
defaultTheme="light"
enableSystem
>
<NFTProvider>
<div className="relative flex min-h-screen flex-col">
<SiteHeader />
<section className="container px-4 mt-4">
{children}
</section>
</div>
<Toaster />
</NFTProvider>
</ThemeProvider>
</CCTXsProvider>
</PricesProvider>
</StakingProvider>
</ValidatorsProvider>
</FeesProvider>
</BalanceProvider>
)
}
Loading

0 comments on commit 542ccb2

Please sign in to comment.