diff --git a/apps/dashboard/package.json b/apps/dashboard/package.json index 4323b134d..a75317815 100644 --- a/apps/dashboard/package.json +++ b/apps/dashboard/package.json @@ -55,7 +55,6 @@ "@stripe/stripe-js": "^3.5.0", "@tanstack/react-query": "^4.36.1", "@tanstack/react-table": "^8.17.3", - "@thirdweb-dev/react": "workspace:*", "@thirdweb-dev/sdk": "workspace:*", "@thirdweb-dev/service-utils": "workspace:*", "@thirdweb-dev/storage": "workspace:*", @@ -169,16 +168,8 @@ "tw-components", "contract-ui" ], - "exclude": [ - "node_modules", - "types", - "tw-components" - ], + "exclude": ["node_modules", "types", "tw-components"], "entrypoints": [] }, - "browserslist": [ - "defaults", - "unreleased versions", - "not UCAndroid > 0" - ] + "browserslist": ["defaults", "unreleased versions", "not UCAndroid > 0"] } diff --git a/apps/dashboard/src/app/providers.tsx b/apps/dashboard/src/app/providers.tsx index a7f3a611e..8fb6d6b09 100644 --- a/apps/dashboard/src/app/providers.tsx +++ b/apps/dashboard/src/app/providers.tsx @@ -1,7 +1,6 @@ "use client"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { DashboardThirdwebProviderSetup } from "components/app-layouts/provider-setup"; import { AllChainsProvider } from "contexts/all-chains"; import { ChainsProvider } from "contexts/configured-chains"; import { ThemeProvider } from "next-themes"; @@ -22,11 +21,9 @@ export function AppRouterProviders(props: { children: React.ReactNode }) { - - - {props.children} - - + + {props.children} + diff --git a/apps/dashboard/src/components/app-layouts/provider-setup.tsx b/apps/dashboard/src/components/app-layouts/provider-setup.tsx index 287024af9..ab75fe87d 100644 --- a/apps/dashboard/src/components/app-layouts/provider-setup.tsx +++ b/apps/dashboard/src/components/app-layouts/provider-setup.tsx @@ -1,119 +1,13 @@ -"use client"; - import { thirdwebClient } from "@/constants/client"; -import { - DASHBOARD_THIRDWEB_CLIENT_ID, - DASHBOARD_THIRDWEB_SECRET_KEY, -} from "@/constants/env"; -import { - type EVMContractInfo, - useEVMContractInfo, -} from "@3rdweb-sdk/react/hooks/useActiveChainId"; -import { useQueryClient } from "@tanstack/react-query"; -import { ThirdwebSDKProvider } from "@thirdweb-dev/react"; import type { Signer } from "ethers"; import * as ethers from "ethers"; -import { useSupportedChains } from "hooks/chains/configureChains"; -import { useNativeColorMode } from "hooks/useNativeColorMode"; -import { getDashboardChainRpc } from "lib/rpc"; -import { StorageSingleton } from "lib/sdk"; -import { useEffect, useMemo, useState } from "react"; +import { useEffect, useState } from "react"; import { toEthersSigner } from "thirdweb/adapters/ethers5"; -import { type ChainMetadata, ethereum } from "thirdweb/chains"; import { useActiveAccount, useActiveWallet, useActiveWalletChain, } from "thirdweb/react"; -import { setThirdwebDomains } from "thirdweb/utils"; -import type { ComponentWithChildren } from "types/component-with-children"; -import type { StoredChain } from "../../contexts/configured-chains"; - -const PLACEHOLDER_CHAIN: StoredChain = { - chainId: 1, - chain: "ETH", - name: "Ethereum", - rpc: [ethereum.rpc], - nativeCurrency: { - decimals: 18, - name: "Ether", - symbol: "ETH", - }, - shortName: "eth", - slug: "ethereum", - testnet: false, -}; - -const THIRDWEB_API_HOST = new URL( - process.env.NEXT_PUBLIC_THIRDWEB_API_HOST || "https://api.thirdweb.com", -) - .toString() - .slice(0, -1); - -const isLocalHost = THIRDWEB_API_HOST.includes("localhost"); - -const DOMAIN = isLocalHost - ? "thirdweb-dev.com" - : THIRDWEB_API_HOST.replace("https://api.", ""); - -// do this upfront -setThirdwebDomains({ - bundler: `bundler.${DOMAIN}`, - inAppWallet: `embedded-wallet.${DOMAIN}`, - pay: `pay.${DOMAIN}`, - rpc: `rpc.${DOMAIN}`, - storage: `storage.${DOMAIN}`, -}); - -export interface DashboardThirdwebProviderProps { - contractInfo?: EVMContractInfo; - activeChain?: ChainMetadata; -} - -export const DashboardThirdwebProviderSetup: ComponentWithChildren< - DashboardThirdwebProviderProps -> = ({ children, activeChain }) => { - useNativeColorMode(); - const queryClient = useQueryClient(); - const supportedChains = useSupportedChains(); - const contractInfo = useEVMContractInfo(); - const chain = contractInfo?.chain; - const readonlySettings = useMemo(() => { - if (!chain) { - return undefined; - } - const rpcUrl = getDashboardChainRpc(chain.chainId, chain); - if (!rpcUrl) { - return undefined; - } - return { - chainId: chain.chainId, - rpcUrl, - }; - }, [chain]); - - const ethersSigner = useEthersSigner(); - - return ( - - {children} - - ); -}; export function useEthersSigner() { const activeWallet = useActiveWallet(); diff --git a/apps/dashboard/src/components/app-layouts/providers.tsx b/apps/dashboard/src/components/app-layouts/providers.tsx index e57cb25b0..8affb29d7 100644 --- a/apps/dashboard/src/components/app-layouts/providers.tsx +++ b/apps/dashboard/src/components/app-layouts/providers.tsx @@ -1,40 +1,12 @@ "use client"; - -import { useEVMContractInfo } from "@3rdweb-sdk/react/hooks/useActiveChainId"; -import { useSupportedChainsSlugRecord } from "hooks/chains/configureChains"; import { useNativeColorMode } from "hooks/useNativeColorMode"; -import { useRouter } from "next/router"; -import { useMemo } from "react"; import { ThirdwebProvider } from "thirdweb/react"; import type { ComponentWithChildren } from "types/component-with-children"; -import { DashboardThirdwebProviderSetup } from "./provider-setup"; export const DashboardThirdwebProvider: ComponentWithChildren = ({ children, }) => { useNativeColorMode(); - const chainsSlugRecord = useSupportedChainsSlugRecord(); - const contractInfo = useEVMContractInfo(); - const router = useRouter(); - const isChainSlugPage = router.pathname === "/[chain_id]"; - const chainByChainSlug = chainsSlugRecord[router.asPath.split("/")[1]]; - const activeChain = useMemo(() => { - return contractInfo?.chain === null - ? undefined - : isChainSlugPage - ? chainByChainSlug - : contractInfo?.chain; - }, [contractInfo, chainByChainSlug, isChainSlugPage]); - - return ( - - - {children} - - - ); + return {children}; }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c41de2007..bdf88bb38 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -233,9 +233,6 @@ importers: '@tanstack/react-table': specifier: ^8.17.3 version: 8.20.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@thirdweb-dev/react': - specifier: workspace:* - version: link:../../legacy_packages/react '@thirdweb-dev/sdk': specifier: workspace:* version: link:../../legacy_packages/sdk