|
1 | 1 | import { getThirdwebClient } from "@/constants/thirdweb.server";
|
| 2 | +import { mapV4ChainToV5Chain } from "contexts/map-chains"; |
2 | 3 | import { cookies } from "next/headers";
|
| 4 | +import { TW_LOCAL_CHAIN_STORE } from "stores/storageKeys"; |
3 | 5 | import { getAddress, getContract, isAddress } from "thirdweb";
|
4 | 6 | 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"; |
8 | 9 |
|
9 | 10 | export async function getContractPageParamsInfo(params: {
|
10 | 11 | contractAddress: string;
|
@@ -47,11 +48,15 @@ export async function getContractPageParamsInfo(params: {
|
47 | 48 | return undefined;
|
48 | 49 | }
|
49 | 50 |
|
| 51 | + // attempt to get the auth token |
| 52 | + const token = getAuthToken(); |
| 53 | + |
50 | 54 | const contract = getContract({
|
51 | 55 | address: contractAddress,
|
52 | 56 | // eslint-disable-next-line no-restricted-syntax
|
53 | 57 | chain: mapV4ChainToV5Chain(chainMetadata),
|
54 |
| - client: getThirdwebClient(), |
| 58 | + // if we have the auth token pass it into the client |
| 59 | + client: getThirdwebClient(token || undefined), |
55 | 60 | });
|
56 | 61 |
|
57 | 62 | return {
|
|
0 commit comments