diff --git a/apps/dashboard/src/app/(app)/(dashboard)/published-contract/[publisher]/[contract_id]/[version]/page.tsx b/apps/dashboard/src/app/(app)/(dashboard)/published-contract/[publisher]/[contract_id]/[version]/page.tsx index a2a4a2f34a7..d58b296790c 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/published-contract/[publisher]/[contract_id]/[version]/page.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/published-contract/[publisher]/[contract_id]/[version]/page.tsx @@ -1,6 +1,5 @@ import { ChakraProviderSetup } from "@/components/ChakraProviderSetup"; import { Separator } from "@/components/ui/separator"; -import { getClientThirdwebClient } from "@/constants/thirdweb-client.client"; import { serverThirdwebClient } from "@/constants/thirdweb-client.server"; import { SimpleGrid } from "@chakra-ui/react"; import { fetchPublishedContractVersions } from "components/contract-components/fetch-contracts-with-versions"; @@ -9,7 +8,7 @@ import { notFound } from "next/navigation"; import { isAddress } from "thirdweb"; import { resolveAddress } from "thirdweb/extensions/ens"; import { getRawAccount } from "../../../../../account/settings/getAccount"; -import { getAuthToken } from "../../../../../api/lib/getAuthToken"; +import { getUserThirdwebClient } from "../../../../../api/lib/getAuthToken"; import { PublishedActions } from "../../../components/contract-actions-published.client"; import { DeployContractHeader } from "../../../components/contract-header"; @@ -68,9 +67,11 @@ export default async function PublishedContractPage( return notFound(); } - const [authToken, account] = await Promise.all([ - getAuthToken(), + const [account, client] = await Promise.all([ getRawAccount(), + getUserThirdwebClient({ + teamId: undefined, + }), ]); return ( @@ -92,10 +93,7 @@ export default async function PublishedContractPage( diff --git a/apps/dashboard/src/app/(app)/(dashboard)/published-contract/components/uri-based-deploy.tsx b/apps/dashboard/src/app/(app)/(dashboard)/published-contract/components/uri-based-deploy.tsx index 7d230f777f4..b2df8c2f09e 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/published-contract/components/uri-based-deploy.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/published-contract/components/uri-based-deploy.tsx @@ -1,10 +1,9 @@ import { getProjects } from "@/api/projects"; import { getTeams } from "@/api/team"; import { ChakraProviderSetup } from "@/components/ChakraProviderSetup"; -import { getClientThirdwebClient } from "@/constants/thirdweb-client.client"; import { CustomContractForm } from "components/contract-components/contract-deploy-form/custom-contract"; import type { FetchDeployMetadataResult } from "thirdweb/contract"; -import { getAuthToken } from "../../../api/lib/getAuthToken"; +import { getUserThirdwebClient } from "../../../api/lib/getAuthToken"; import { loginRedirect } from "../../../login/loginRedirect"; type DeployFormForUriProps = { @@ -21,9 +20,14 @@ export async function DeployFormForUri(props: DeployFormForUriProps) { return
Could not fetch metadata
; } - const [authToken, teams] = await Promise.all([getAuthToken(), getTeams()]); + const [teams, client] = await Promise.all([ + getTeams(), + getUserThirdwebClient({ + teamId: undefined, + }), + ]); - if (!teams || !authToken) { + if (!teams) { loginRedirect(pathname); } @@ -43,11 +47,6 @@ export async function DeployFormForUri(props: DeployFormForUriProps) { })), ); - const client = getClientThirdwebClient({ - jwt: authToken, - teamId: undefined, - }); - // TODO: remove the `ChakraProviderSetup` wrapper once the form is updated to no longer use chakra return ( @@ -55,7 +54,7 @@ export async function DeployFormForUri(props: DeployFormForUriProps) { metadata={contractMetadata} metadataNoFee={contractMetadataNoFee} modules={modules?.filter((m) => m !== null)} - isLoggedIn={!!authToken} + isLoggedIn={true} teamsAndProjects={teamsAndProjects} client={client} />