Skip to content

Commit e552fda

Browse files
authored
fix auth token (#4870)
1 parent cddeda4 commit e552fda

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/_utils/getContractFromParams.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { getThirdwebClient } from "@/constants/thirdweb.server";
2+
import { mapV4ChainToV5Chain } from "contexts/map-chains";
23
import { cookies } from "next/headers";
4+
import { TW_LOCAL_CHAIN_STORE } from "stores/storageKeys";
35
import { getAddress, getContract, isAddress } from "thirdweb";
46
import type { ChainMetadata } from "thirdweb/chains";
5-
import { mapV4ChainToV5Chain } from "../../../../../../contexts/map-chains";
6-
import { TW_LOCAL_CHAIN_STORE } from "../../../../../../stores/storageKeys";
7-
import { fetchChain } from "../../../../../../utils/fetchChain";
7+
import { fetchChain } from "utils/fetchChain";
8+
import { getAuthToken } from "../../../../../api/lib/getAuthToken";
89

910
export async function getContractPageParamsInfo(params: {
1011
contractAddress: string;
@@ -47,11 +48,15 @@ export async function getContractPageParamsInfo(params: {
4748
return undefined;
4849
}
4950

51+
// attempt to get the auth token
52+
const token = getAuthToken();
53+
5054
const contract = getContract({
5155
address: contractAddress,
5256
// eslint-disable-next-line no-restricted-syntax
5357
chain: mapV4ChainToV5Chain(chainMetadata),
54-
client: getThirdwebClient(),
58+
// if we have the auth token pass it into the client
59+
client: getThirdwebClient(token || undefined),
5560
});
5661

5762
return {

0 commit comments

Comments
 (0)