diff --git a/.scripts/set-local-install.js b/.scripts/set-local-install.js new file mode 100644 index 000000000..2ad93e82d --- /dev/null +++ b/.scripts/set-local-install.js @@ -0,0 +1,16 @@ +const { execSync } = require("child_process"); +const path = require("path"); + +try { + const scriptPath = path.resolve(__dirname, "vercel-local-install.sh"); + console.log("Running local installation script..."); + + execSync(`bash ${scriptPath}`, { + stdio: "inherit", + }); + + console.log("Local installation completed successfully"); +} catch (error) { + console.error("Error during local installation:", error.message); + process.exit(1); +} diff --git a/.scripts/vercel-local-install.sh b/.scripts/vercel-local-install.sh new file mode 100644 index 000000000..736093fd6 --- /dev/null +++ b/.scripts/vercel-local-install.sh @@ -0,0 +1,5 @@ +# if secrets folder exists, copy the static folder to the apps +if [ -d "secrets/static" ]; then + mkdir -p apps/hub/public/internal-env + cp -r secrets/static/* apps/hub/public/internal-env +fi \ No newline at end of file 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..e7f7160da 100755 --- a/apps/hub/src/app/Providers.tsx +++ b/apps/hub/src/app/Providers.tsx @@ -1,14 +1,24 @@ "use client"; import React, { useEffect, type PropsWithChildren } from "react"; -import { BeraJsProvider, BlockTimeProvider } from "@bera/berajs"; +import { + BeraJsProvider, + BlockTimeProvider, + SWRFallback, + formatTokenList, +} from "@bera/berajs"; +import { chainId, 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 +34,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 11e40a1ca..a4880463f 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 { chainId, hubName, hubUrl, tokenListUrl } from "@bera/config"; import { Footer, Header, @@ -35,7 +37,12 @@ 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 fileContent = readFileSync( + path.join(process.cwd(), `public/${tokenListUrl}`), + "utf8", + ); + const fetchedTokenList = JSON.parse(fileContent); return (