diff --git a/apps/hub/next.config.mjs b/apps/hub/next.config.mjs index 767aa5474..87bf03362 100755 --- a/apps/hub/next.config.mjs +++ b/apps/hub/next.config.mjs @@ -39,6 +39,9 @@ const config = { "res.cloudinary.com", "raw.githubusercontent.com", "s3.amazonaws.com", + "assets.coingecko.com", + "artio-static-asset-public.s3.ap-southeast-1.amazonaws.com", // clean this up with new links + // Add google cdn here as well ], }, }; diff --git a/apps/hub/src/app/Providers.tsx b/apps/hub/src/app/Providers.tsx index b8a4caa23..52b5422d9 100755 --- a/apps/hub/src/app/Providers.tsx +++ b/apps/hub/src/app/Providers.tsx @@ -1,14 +1,19 @@ "use client"; import React, { useEffect, type PropsWithChildren } from "react"; -import { BeraJsProvider, BlockTimeProvider } from "@bera/berajs"; +import { BeraJsProvider, BlockTimeProvider, SWRFallback } from "@bera/berajs"; +import { tokenListUrl } from "@bera/config"; import { BeraWagmi } from "@bera/wagmi"; import posthog from "posthog-js"; import { PostHogProvider } from "posthog-js/react"; +import { unstable_serialize } from "swr"; import { ThemeProvider } from "~/components/theme-provider"; -export default function Providers({ children }: PropsWithChildren) { +export default function Providers({ + children, + content, +}: PropsWithChildren) { useEffect(() => { if (!process.env.NEXT_PUBLIC_POSTHOG_KEY) { return; @@ -24,14 +29,21 @@ export default function Providers({ children }: PropsWithChildren) { - - {children} - + + {children} + + diff --git a/apps/hub/src/app/layout.tsx b/apps/hub/src/app/layout.tsx index 262f83adf..221ec11dc 100755 --- a/apps/hub/src/app/layout.tsx +++ b/apps/hub/src/app/layout.tsx @@ -1,9 +1,11 @@ import "../styles/globals.css"; +import { readFileSync } from "fs"; +import path from "path"; import { Metadata } from "next"; import dynamic from "next/dynamic"; import { IBM_Plex_Sans } from "next/font/google"; import Script from "next/script"; -import { hubName, hubUrl } from "@bera/config"; +import { hubName, hubUrl, tokenListUrl } from "@bera/config"; import { Footer, Header, @@ -35,7 +37,16 @@ const PostHogPageView = dynamic(() => import("./PostHogPageView"), { ssr: false, }); -export default function RootLayout(props: { children: React.ReactNode }) { +export default async function RootLayout(props: { children: React.ReactNode }) { + const fetchedTokenList = await (tokenListUrl.startsWith("http") + ? fetch(tokenListUrl).then((res) => res.json()) + : JSON.parse( + readFileSync( + path.join(process.cwd(), `public/${tokenListUrl}`), + "utf8", + ), + )); + return (