diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/cancel-tab.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/cancel-tab.tsx index 5f02901bfcd..39d15bd4cda 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/cancel-tab.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/cancel-tab.tsx @@ -30,6 +30,7 @@ export const CancelTab: React.FC = ({ return (
= ({ Cancel = ({ hasRemovedPhases || !isMultiPhase ? ( = ({ return ( }> = ({ value={amount} /> = ({ return ( { diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/components/BatchMetadata.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/components/BatchMetadata.tsx index fed908fd112..621b03ce0e6 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/components/BatchMetadata.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/components/BatchMetadata.tsx @@ -23,7 +23,7 @@ import { useTxNotifications } from "hooks/useTxNotifications"; import { CircleAlertIcon } from "lucide-react"; import { useCallback } from "react"; import { useForm } from "react-hook-form"; -import { sendAndConfirmTransaction } from "thirdweb"; +import { type ThirdwebClient, sendAndConfirmTransaction } from "thirdweb"; import { BatchMetadataERC721, BatchMetadataERC1155 } from "thirdweb/modules"; import { parseAttributes } from "utils/parseAttributes"; import { z } from "zod"; @@ -105,6 +105,7 @@ export function BatchMetadataModuleUI( uploadMetadata: (values: UploadMetadataFormValues) => Promise; contractChainId: number; isLoggedIn: boolean; + client: ThirdwebClient; }, ) { return ( @@ -122,6 +123,7 @@ export function BatchMetadataModuleUI( isLoggedIn={props.isLoggedIn} uploadMetadata={props.uploadMetadata} contractChainId={props.contractChainId} + client={props.client} /> )} {!props.isOwnerAccount && ( @@ -164,6 +166,7 @@ function UploadMetadataNFTSection(props: { uploadMetadata: (values: UploadMetadataFormValues) => Promise; contractChainId: number; isLoggedIn: boolean; + client: ThirdwebClient; }) { const form = useForm({ resolver: zodResolver(uploadMetadataFormSchema), @@ -262,6 +265,7 @@ function UploadMetadataNFTSection(props: {
{props.primarySaleRecipientSection.data ? ( ({ resolver: zodResolver(primarySaleRecipientFormSchema), @@ -823,6 +831,7 @@ function PrimarySaleRecipientSection(props: {
({ resolver: zodResolver(mintFormSchema), @@ -940,6 +950,7 @@ function MintNFTSection(props: {
)} {!props.isOwnerAccount && ( @@ -243,6 +249,7 @@ export function MintableModuleUI( update={props.updatePrimaryRecipient} contractChainId={props.contractChainId} isLoggedIn={props.isLoggedIn} + client={props.client} /> @@ -263,6 +270,7 @@ function PrimarySalesSection(props: { isOwnerAccount: boolean; contractChainId: number; isLoggedIn: boolean; + client: ThirdwebClient; }) { const form = useForm({ resolver: zodResolver(primarySaleRecipientFormSchema), @@ -312,6 +320,7 @@ function PrimarySalesSection(props: {
({ resolver: zodResolver(mintFormSchema), @@ -524,6 +534,7 @@ function MintNFTSection(props: {
{ {/* Submit */}
)} {!props.isOwnerAccount && ( @@ -122,6 +123,7 @@ function SetSharedMetadataSection(props: { setSharedMetadata: (values: SetSharedMetadataFormValues) => Promise; contractChainId: number; isLoggedIn: boolean; + client: ThirdwebClient; }) { const form = useForm({ resolver: zodResolver(setSharedMetadataFormSchema), @@ -213,6 +215,7 @@ function SetSharedMetadataSection(props: {
) : ( @@ -210,6 +211,7 @@ export function RoyaltyModuleUI( defaultRoyaltyInfo={props.defaultRoyaltyInfo} contractChainId={props.contractChainId} isLoggedIn={props.isLoggedIn} + client={props.client} /> ) : ( @@ -233,6 +235,7 @@ export function RoyaltyModuleUI( transferValidator={props.transferValidator} contractChainId={props.contractChainId} isLoggedIn={props.isLoggedIn} + client={props.client} /> ) : ( @@ -270,6 +273,7 @@ function RoyaltyInfoPerTokenSection(props: { setRoyaltyInfoForToken: (values: RoyaltyInfoFormValues) => Promise; contractChainId: number; isLoggedIn: boolean; + client: ThirdwebClient; }) { const form = useForm({ resolver: zodResolver(royaltyInfoFormSchema), @@ -349,6 +353,7 @@ function RoyaltyInfoPerTokenSection(props: {
Promise; contractChainId: number; isLoggedIn: boolean; + client: ThirdwebClient; }) { const [defaultRoyaltyRecipient, defaultRoyaltyPercentage] = props.defaultRoyaltyInfo || []; @@ -453,6 +459,7 @@ function DefaultRoyaltyInfoSection(props: {
Promise; contractChainId: number; isLoggedIn: boolean; + client: ThirdwebClient; }) { const form = useForm({ resolver: zodResolver(transferValidatorFormSchema), @@ -531,6 +539,7 @@ function TransferValidatorSection(props: {
{ return ( = ({ more, please do it in multiple transactions.

= ({ contract, tokenId, isLoggedIn }) => { )} = ({ = ({ /> = ({ )}
= ({ Cancel = ({ { // nice, we can set up everything the same for both the only thing that changes is the action string diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/claim-button.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/claim-button.tsx index 37022762dc4..23b1d19b2be 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/claim-button.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/claim-button.tsx @@ -107,6 +107,7 @@ export const NFTClaimButton: React.FC = ({
= ({ Cancel = ({ = ({
= ({ return ( = ({ Cancel = ({ tokensDelegatedQuery.data ? (
= ({
= ({
= ({ return ( = ({ return ( = ({ )} = ({ = ({ = ({ = ({ + )}
))} @@ -449,9 +452,11 @@ function TypedDataRestrictions({ function PersonalSignRestrictions({ control, index, + client, }: { control: Control; index: number; + client: ThirdwebClient; }) { const personalSignArray = useFieldArray({ control, @@ -527,6 +532,7 @@ function PersonalSignRestrictions({ control={control} opIndex={index} signIndex={signIndex} + client={client} /> ) : ( ; opIndex: number; signIndex: number; + client: ThirdwebClient; }) { - const client = useThirdwebClient(); const userOpTransactionsArray = useFieldArray({ control, name: `accessControl.allowedOperations.${opIndex}.allowedPersonalSigns.${signIndex}.allowedTransactions`, diff --git a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/launch/launch-token.tsx b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/launch/launch-token.tsx index ab756374369..91a9288fa54 100644 --- a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/launch/launch-token.tsx +++ b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/launch/launch-token.tsx @@ -174,6 +174,7 @@ export function LaunchTokenStatus(props: { type: "custom", custom: ( = ({ instanceUrl, authToken }) => { +> = ({ instanceUrl, authToken, client }) => { const disclosure = useDisclosure(); return ( @@ -70,6 +70,7 @@ export const AddContractSubscriptionButton: React.FC< instanceUrl={instanceUrl} disclosure={disclosure} authToken={authToken} + client={client} /> )} @@ -90,10 +91,12 @@ const AddModal = ({ instanceUrl, disclosure, authToken, + client, }: { instanceUrl: string; disclosure: UseDisclosureReturn; authToken: string; + client: ThirdwebClient; }) => { const { mutate: addContractSubscription } = useEngineAddContractSubscription({ instanceUrl, @@ -171,9 +174,17 @@ const AddModal = ({ {modalState === "inputContract" ? ( - + ) : modalState === "inputData" ? ( - + ) : null} @@ -183,11 +194,12 @@ const AddModal = ({ const ModalBodyInputContract = ({ form, setModalState, + client, }: { form: UseFormReturn; setModalState: Dispatch>; + client: ThirdwebClient; }) => { - const client = useThirdwebClient(); return ( <> @@ -278,9 +290,11 @@ const ModalBodyInputContract = ({ const ModalBodyInputData = ({ form, setModalState, + client, }: { form: UseFormReturn; setModalState: Dispatch>; + client: ThirdwebClient; }) => { const processEventLogsDisclosure = useDisclosure({ defaultIsOpen: form.getValues("processEventLogs"), @@ -372,6 +386,7 @@ const ModalBodyInputData = ({ setFilter={(value) => form.setValue("filterEvents", value) } + client={client} />
@@ -428,6 +443,7 @@ const ModalBodyInputData = ({ setFilter={(value) => form.setValue("filterFunctions", value) } + client={client} />
@@ -464,14 +480,15 @@ const FilterSelector = ({ form, filter, setFilter, + client, }: { abiItemType: "function" | "event"; form: UseFormReturn; filter: string[]; setFilter: (value: string[]) => void; + client: ThirdwebClient; }) => { - const client = useThirdwebClient(); const chain = useV5DashboardChain(form.getValues("chainId")); const address = form.getValues("contractAddress"); const contract = useMemo( diff --git a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/contract-subscriptions/components/contract-subscriptions-table.tsx b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/contract-subscriptions/components/contract-subscriptions-table.tsx index 8afde003a7b..bc11a2eb0a7 100644 --- a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/contract-subscriptions/components/contract-subscriptions-table.tsx +++ b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/contract-subscriptions/components/contract-subscriptions-table.tsx @@ -1,7 +1,6 @@ "use client"; import { CopyAddressButton } from "@/components/ui/CopyAddressButton"; -import { useThirdwebClient } from "@/constants/thirdweb.client"; import { type EngineContractSubscription, useEngineRemoveContractSubscription, @@ -215,6 +214,7 @@ export const ContractSubscriptionTable: React.FC< chainId={chainId} autoUpdate={autoUpdate} authToken={authToken} + client={client} /> ); }, @@ -258,11 +258,12 @@ export const ContractSubscriptionTable: React.FC< const ChainLastBlockTimestamp = ({ chainId, blockNumber, + client, }: { chainId: number; blockNumber: bigint; + client: ThirdwebClient; }) => { - const client = useThirdwebClient(); const chain = useV5DashboardChain(chainId); // Get the block timestamp to display how delayed the last processed block is. const ethBlockQuery = useQuery({ @@ -298,11 +299,13 @@ const ChainLastBlock = ({ chainId, autoUpdate, authToken, + client, }: { instanceUrl: string; chainId: number; autoUpdate: boolean; authToken: string; + client: ThirdwebClient; }) => { const lastBlockQuery = useEngineSubscriptionsLastBlock({ instanceUrl, @@ -325,6 +328,7 @@ const ChainLastBlock = ({ } shouldWrapChildren diff --git a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/contract-subscriptions/components/engine-contract-subscription.tsx b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/contract-subscriptions/components/engine-contract-subscription.tsx index bc726d53f97..fba119fe45f 100644 --- a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/contract-subscriptions/components/engine-contract-subscription.tsx +++ b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/contract-subscriptions/components/engine-contract-subscription.tsx @@ -1,6 +1,5 @@ "use client"; -import { useThirdwebClient } from "@/constants/thirdweb.client"; import { useEngineContractSubscription } from "@3rdweb-sdk/react/hooks/useEngine"; import { Flex, FormControl, Switch } from "@chakra-ui/react"; import { useState } from "react"; @@ -8,16 +7,17 @@ import { FormLabel, Heading, Text, TrackedLink } from "tw-components"; import { AddContractSubscriptionButton } from "./add-contract-subscription-button"; import { ContractSubscriptionTable } from "./contract-subscriptions-table"; +import type { ThirdwebClient } from "thirdweb"; interface EngineContractSubscriptionsProps { instanceUrl: string; authToken: string; + client: ThirdwebClient; } export const EngineContractSubscriptions: React.FC< EngineContractSubscriptionsProps -> = ({ instanceUrl, authToken }) => { +> = ({ instanceUrl, authToken, client }) => { const [autoUpdate, setAutoUpdate] = useState(true); - const client = useThirdwebClient(); const contractSubscriptionsQuery = useEngineContractSubscription({ instanceUrl, authToken, @@ -67,6 +67,7 @@ export const EngineContractSubscriptions: React.FC< ); diff --git a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/contract-subscriptions/page.tsx b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/contract-subscriptions/page.tsx index a7bbc8a3d67..bf2cdf1cff6 100644 --- a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/contract-subscriptions/page.tsx +++ b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/contract-subscriptions/page.tsx @@ -4,7 +4,7 @@ import { EngineContractSubscriptions } from "./components/engine-contract-subscr export default async function Page(props: EngineInstancePageProps) { const params = await props.params; - const { instance, authToken } = await engineInstancePageHandler({ + const { instance, authToken, client } = await engineInstancePageHandler({ engineId: params.engineId, teamSlug: params.team_slug, projectSlug: params.project_slug, @@ -14,6 +14,7 @@ export default async function Page(props: EngineInstancePageProps) { ); } diff --git a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/overview/components/engine-overview.tsx b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/overview/components/engine-overview.tsx index 8b4f7fa4b5b..1ab2d887957 100644 --- a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/overview/components/engine-overview.tsx +++ b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/overview/components/engine-overview.tsx @@ -2,7 +2,6 @@ import { SingleNetworkSelector } from "@/components/blocks/NetworkSelectors"; import { UnderlineLink } from "@/components/ui/UnderlineLink"; import { TrackedUnderlineLink } from "@/components/ui/tracked-link"; -import { useThirdwebClient } from "@/constants/thirdweb.client"; import { type EngineInstance, useEngineBackendWallets, @@ -21,6 +20,7 @@ interface EngineOverviewProps { teamSlug: string; projectSlug: string; authToken: string; + client: ThirdwebClient; } export const EngineOverview: React.FC = ({ @@ -28,9 +28,8 @@ export const EngineOverview: React.FC = ({ teamSlug, projectSlug, authToken, + client, }) => { - const client = useThirdwebClient(); - return (
); } diff --git a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/relayers/components/add-relayer-button.tsx b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/relayers/components/add-relayer-button.tsx index 25ac436ea03..51ba47c222a 100644 --- a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/relayers/components/add-relayer-button.tsx +++ b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/relayers/components/add-relayer-button.tsx @@ -1,5 +1,4 @@ import { SingleNetworkSelector } from "@/components/blocks/NetworkSelectors"; -import { useThirdwebClient } from "@/constants/thirdweb.client"; import { type CreateRelayerInput, useEngineBackendWallets, @@ -26,17 +25,20 @@ import { useAllChainsData } from "hooks/chains/allChains"; import { useTxNotifications } from "hooks/useTxNotifications"; import { CirclePlusIcon } from "lucide-react"; import { useForm } from "react-hook-form"; +import type { ThirdwebClient } from "thirdweb"; import { isAddress, shortenAddress } from "thirdweb/utils"; import { Button, FormHelperText, FormLabel } from "tw-components"; interface AddRelayerButtonProps { instanceUrl: string; authToken: string; + client: ThirdwebClient; } export const AddRelayerButton: React.FC = ({ instanceUrl, authToken, + client, }) => { const disclosure = useDisclosure(); @@ -58,6 +60,7 @@ export const AddRelayerButton: React.FC = ({ instanceUrl={instanceUrl} disclosure={disclosure} authToken={authToken} + client={client} /> )} @@ -76,12 +79,13 @@ const AddModal = ({ instanceUrl, disclosure, authToken, + client, }: { instanceUrl: string; disclosure: UseDisclosureReturn; authToken: string; + client: ThirdwebClient; }) => { - const client = useThirdwebClient(); const { mutate: createRelayer } = useEngineCreateRelayer({ instanceUrl, authToken, diff --git a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/relayers/components/engine-relayer.tsx b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/relayers/components/engine-relayer.tsx index 6529bb420a8..f60712b2a0d 100644 --- a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/relayers/components/engine-relayer.tsx +++ b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/relayers/components/engine-relayer.tsx @@ -1,6 +1,7 @@ "use client"; import { useEngineRelayer } from "@3rdweb-sdk/react/hooks/useEngine"; +import type { ThirdwebClient } from "thirdweb"; import { Heading, Link, Text } from "tw-components"; import { AddRelayerButton } from "./add-relayer-button"; import { RelayersTable } from "./relayers-table"; @@ -8,11 +9,13 @@ import { RelayersTable } from "./relayers-table"; interface EngineRelayerProps { instanceUrl: string; authToken: string; + client: ThirdwebClient; } export const EngineRelayer: React.FC = ({ instanceUrl, authToken, + client, }) => { const relayers = useEngineRelayer({ instanceUrl, @@ -43,8 +46,13 @@ export const EngineRelayer: React.FC = ({ isPending={relayers.isPending} isFetched={relayers.isFetched} authToken={authToken} + client={client} + /> + -
); }; diff --git a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/relayers/components/relayers-table.tsx b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/relayers/components/relayers-table.tsx index 55f5b94bedc..b752fe6382c 100644 --- a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/relayers/components/relayers-table.tsx +++ b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/relayers/components/relayers-table.tsx @@ -1,5 +1,4 @@ import { SingleNetworkSelector } from "@/components/blocks/NetworkSelectors"; -import { useThirdwebClient } from "@/constants/thirdweb.client"; import { type EngineRelayer, type UpdateRelayerInput, @@ -32,6 +31,7 @@ import { useTxNotifications } from "hooks/useTxNotifications"; import { PencilIcon, Trash2Icon } from "lucide-react"; import { useState } from "react"; import { useForm } from "react-hook-form"; +import type { ThirdwebClient } from "thirdweb"; import { shortenAddress } from "thirdweb/utils"; import { Button, @@ -49,6 +49,7 @@ interface RelayersTableProps { isPending: boolean; isFetched: boolean; authToken: string; + client: ThirdwebClient; } const columnHelper = createColumnHelper(); @@ -59,12 +60,12 @@ export const RelayersTable: React.FC = ({ isPending, isFetched, authToken, + client, }) => { const editDisclosure = useDisclosure(); const removeDisclosure = useDisclosure(); const [selectedRelayer, setSelectedRelayer] = useState(); const { idToChain } = useAllChainsData(); - const client = useThirdwebClient(); const columns = [ columnHelper.accessor("chainId", { @@ -191,6 +192,7 @@ export const RelayersTable: React.FC = ({ disclosure={editDisclosure} instanceUrl={instanceUrl} authToken={authToken} + client={client} /> )} {selectedRelayer && removeDisclosure.isOpen && ( @@ -199,6 +201,7 @@ export const RelayersTable: React.FC = ({ disclosure={removeDisclosure} instanceUrl={instanceUrl} authToken={authToken} + client={client} /> )} @@ -210,13 +213,14 @@ const EditModal = ({ disclosure, instanceUrl, authToken, + client, }: { relayer: EngineRelayer; disclosure: UseDisclosureReturn; instanceUrl: string; authToken: string; + client: ThirdwebClient; }) => { - const client = useThirdwebClient(); const { mutate: updateRelayer } = useEngineUpdateRelayer({ instanceUrl, authToken, @@ -355,13 +359,14 @@ const RemoveModal = ({ disclosure, instanceUrl, authToken, + client, }: { relayer: EngineRelayer; disclosure: UseDisclosureReturn; instanceUrl: string; authToken: string; + client: ThirdwebClient; }) => { - const client = useThirdwebClient(); const { mutate: revokeRelayer } = useEngineRevokeRelayer({ instanceUrl, authToken, diff --git a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/relayers/page.tsx b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/relayers/page.tsx index c619554fda7..b8a10ccba06 100644 --- a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/relayers/page.tsx +++ b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/dedicated/(instance)/[engineId]/relayers/page.tsx @@ -4,11 +4,17 @@ import { EngineRelayer } from "./components/engine-relayer"; export default async function Page(props: EngineInstancePageProps) { const params = await props.params; - const { instance, authToken } = await engineInstancePageHandler({ + const { instance, authToken, client } = await engineInstancePageHandler({ engineId: params.engineId, teamSlug: params.team_slug, projectSlug: params.project_slug, }); - return ; + return ( + + ); } diff --git a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/CreateWebhookModal.tsx b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/CreateWebhookModal.tsx index 35cdaf0387f..acf5aedc479 100644 --- a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/CreateWebhookModal.tsx +++ b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/CreateWebhookModal.tsx @@ -8,7 +8,6 @@ import { DialogTrigger, } from "@/components/ui/dialog"; import { Form } from "@/components/ui/form"; -import { useThirdwebClient } from "@/constants/thirdweb.client"; import { useDashboardRouter } from "@/lib/DashboardRouter"; import { zodResolver } from "@hookform/resolvers/zod"; import { useState } from "react"; @@ -21,6 +20,7 @@ import ReviewStep from "./ReviewStep"; import { createWebhook } from "@/api/insight/webhooks"; import { XIcon } from "lucide-react"; +import type { ThirdwebClient } from "thirdweb"; import { useAbiMultiFetch } from "../hooks/useAbiProcessing"; import { useTestWebhook } from "../hooks/useTestWebhook"; import { @@ -40,16 +40,17 @@ import { } from "../utils/webhookTypes"; interface CreateWebhookModalProps { - clientId: string; + projectClientId: string; supportedChainIds: Array; + client: ThirdwebClient; } export function CreateWebhookModal({ - clientId, + projectClientId, supportedChainIds, + client, }: CreateWebhookModalProps) { const router = useDashboardRouter(); - const thirdwebClient = useThirdwebClient(); const [isOpen, setIsOpen] = useState(false); const [currentStep, setCurrentStep] = useState( WebhookFormSteps.BasicInfo, @@ -83,7 +84,7 @@ export function CreateWebhookModal({ const eventAbi = useAbiMultiFetch({ isOpen, - thirdwebClient, + thirdwebClient: client, chainIds, addresses, extractSignatures: extractEventSignatures, @@ -92,7 +93,7 @@ export function CreateWebhookModal({ const txAbi = useAbiMultiFetch({ isOpen, - thirdwebClient, + thirdwebClient: client, chainIds, addresses: toAddresses || "", extractSignatures: extractFunctionSignatures, @@ -127,7 +128,7 @@ export function CreateWebhookModal({ payload = buildTransactionWebhookPayload(data); } - const response = await createWebhook(payload, clientId); + const response = await createWebhook(payload, projectClientId); if (response?.error) { toast.error(`${response.error}`); return; @@ -213,7 +214,7 @@ export function CreateWebhookModal({ }; const { testWebhookEndpoint, isTestingMap, testResults, isRecentResult } = - useTestWebhook(clientId); + useTestWebhook(projectClientId); const handleTestWebhook = async (webhookUrl: string) => { const filterType = formHook.getValues("filterType"); @@ -262,6 +263,7 @@ export function CreateWebhookModal({ {currentStep === WebhookFormSteps.FilterDetails && ( void; isLoading: boolean; supportedChainIds: Array; + client: ThirdwebClient; } interface SignatureDropdownProps { @@ -130,8 +130,8 @@ export function FilterDetailsStep({ goToPreviousStep, isLoading, supportedChainIds, + client, }: FilterDetailsStepProps) { - const thirdwebClient = useThirdwebClient(); const queryClient = useQueryClient(); const watchFilterType = form.watch("filterType") as | "event" @@ -175,7 +175,7 @@ export function FilterDetailsStep({ Array.isArray(field.value) ? field.value.map(Number) : [] } onChange={(chainIds) => field.onChange(chainIds.map(String))} - client={thirdwebClient} + client={client} chainIds={supportedChainIds} /> diff --git a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/WebhooksTable.tsx b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/WebhooksTable.tsx index b7a89b3f20b..3bee109778a 100644 --- a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/WebhooksTable.tsx +++ b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/WebhooksTable.tsx @@ -16,6 +16,7 @@ import { format } from "date-fns"; import { PlayIcon, TrashIcon } from "lucide-react"; import { useMemo, useState } from "react"; import { toast } from "sonner"; +import type { ThirdwebClient } from "thirdweb"; import { useTestWebhook } from "../hooks/useTestWebhook"; import { CreateWebhookModal } from "./CreateWebhookModal"; import { RelativeTime } from "./RelativeTime"; @@ -31,17 +32,19 @@ function getEventType(filters: WebhookFilters): string { interface WebhooksTableProps { webhooks: WebhookResponse[]; - clientId: string; + projectClientId: string; supportedChainIds: number[]; + client: ThirdwebClient; } export function WebhooksTable({ webhooks, - clientId, + projectClientId, + client, supportedChainIds, }: WebhooksTableProps) { const [isDeleting, setIsDeleting] = useState>({}); - const { testWebhookEndpoint, isTestingMap } = useTestWebhook(clientId); + const { testWebhookEndpoint, isTestingMap } = useTestWebhook(projectClientId); const router = useDashboardRouter(); const handleDeleteWebhook = async (webhookId: string) => { @@ -49,7 +52,7 @@ export function WebhooksTable({ try { setIsDeleting((prev) => ({ ...prev, [webhookId]: true })); - await deleteWebhook(webhookId, clientId); + await deleteWebhook(webhookId, projectClientId); toast.success("Webhook deleted successfully"); router.refresh(); } catch (error) { @@ -216,8 +219,9 @@ export function WebhooksTable({
}) { let webhooks: WebhookResponse[] = []; - let clientId = ""; let errorMessage = ""; let supportedChainIds: number[] = []; - try { - // Await params before accessing properties - const resolvedParams = await params; - const team_slug = resolvedParams.team_slug; - const project_slug = resolvedParams.project_slug; + const [authToken, resolvedParams] = await Promise.all([ + getAuthToken(), + params, + ]); - const project = await getProject(team_slug, project_slug); + const project = await getProject( + resolvedParams.team_slug, + resolvedParams.project_slug, + ); - if (!project) { - notFound(); - } + if (!project || !authToken) { + notFound(); + } - clientId = project.publishableKey; + const projectClientId = project.publishableKey; - const webhooksRes = await getWebhooks(clientId); + try { + const webhooksRes = await getWebhooks(projectClientId); if (webhooksRes.error) { errorMessage = webhooksRes.error; } else if (webhooksRes.data) { @@ -49,6 +53,11 @@ export default async function WebhooksPage({ console.error("Error loading project or webhooks", error); } + const client = getClientThirdwebClient({ + jwt: authToken, + teamId: project.teamId, + }); + return (
@@ -85,7 +94,8 @@ export default async function WebhooksPage({ ) : webhooks.length > 0 ? ( ) : ( @@ -97,7 +107,8 @@ export default async function WebhooksPage({

diff --git a/apps/dashboard/src/app/nebula-app/(app)/chat/[session_id]/page.tsx b/apps/dashboard/src/app/nebula-app/(app)/chat/[session_id]/page.tsx index 703f0018778..36abb6f5c2e 100644 --- a/apps/dashboard/src/app/nebula-app/(app)/chat/[session_id]/page.tsx +++ b/apps/dashboard/src/app/nebula-app/(app)/chat/[session_id]/page.tsx @@ -6,6 +6,7 @@ import { } from "../../../_utils/authToken"; import { getSessionById } from "../../api/session"; import { ChatPageContent } from "../../components/ChatPageContent"; +import { nebulaAppThirdwebClient } from "../../utils/nebulaThirdwebClient"; export default async function Page(props: { params: Promise<{ @@ -34,6 +35,7 @@ export default async function Page(props: { >(() => { if (props.session?.history) { @@ -344,7 +344,7 @@ export function ChatPageContent(props: { authToken={props.authToken} sessionId={sessionId} className="min-w-0 pt-6 pb-32" - client={client} + client={props.client} enableAutoScroll={enableAutoScroll} setEnableAutoScroll={setEnableAutoScroll} sendMessage={handleSendMessage} @@ -358,7 +358,7 @@ export function ChatPageContent(props: { showContextSelector={true} connectedWallets={connectedWalletsMeta} setActiveWallet={handleSetActiveWallet} - client={client} + client={props.client} prefillMessage={undefined} sendMessage={handleSendMessage} isChatStreaming={isChatStreaming} diff --git a/apps/dashboard/src/app/nebula-app/(app)/components/ExecuteTransactionCard.tsx b/apps/dashboard/src/app/nebula-app/(app)/components/ExecuteTransactionCard.tsx index 6d92fcb0464..abb384b03fc 100644 --- a/apps/dashboard/src/app/nebula-app/(app)/components/ExecuteTransactionCard.tsx +++ b/apps/dashboard/src/app/nebula-app/(app)/components/ExecuteTransactionCard.tsx @@ -129,6 +129,7 @@ export function ExecuteTransactionCardLayout(props: { {props.status.type !== "confirmed" && (
; + return ( + + ); } - return ; + return ( + + ); } function CustomConnectEmbed(props: { onLogin: () => void; + client: ThirdwebClient; }) { const { theme } = useTheme(); - const client = useThirdwebClient(); const [turnstileToken, setTurnstileToken] = useState( undefined, ); @@ -168,7 +173,7 @@ function CustomConnectEmbed(props: { }, }} wallets={loginOptions} - client={client} + client={props.client} modalSize="wide" theme={getSDKTheme(theme === "light" ? "light" : "dark")} className="shadow-lg" diff --git a/apps/dashboard/src/components/buttons/MismatchButton.tsx b/apps/dashboard/src/components/buttons/MismatchButton.tsx index 04fe45a3ab0..813dcb4c672 100644 --- a/apps/dashboard/src/components/buttons/MismatchButton.tsx +++ b/apps/dashboard/src/components/buttons/MismatchButton.tsx @@ -16,7 +16,6 @@ import { PopoverContent, PopoverTrigger, } from "@/components/ui/popover"; -import { useThirdwebClient } from "@/constants/thirdweb.client"; import { cn } from "@/lib/utils"; import { useMutation, useQuery } from "@tanstack/react-query"; import { FaucetButton } from "app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/FaucetButton"; @@ -86,6 +85,7 @@ type MistmatchButtonProps = React.ComponentProps & { isLoggedIn: boolean; isPending: boolean; checkBalance?: boolean; + client: ThirdwebClient; }; export const MismatchButton = forwardRef< @@ -104,7 +104,6 @@ export const MismatchButton = forwardRef< const activeWalletChain = useActiveWalletChain(); const [dialog, setDialog] = useState(); const { theme } = useTheme(); - const client = useThirdwebClient(); const pathname = usePathname(); const txChain = useV5DashboardChain(txChainId); const connectionStatus = useActiveWalletConnectionStatus(); @@ -112,7 +111,7 @@ export const MismatchButton = forwardRef< const txChainBalance = useWalletBalance({ address: account?.address, chain: txChain, - client, + client: props.client, }); const networksMismatch = useIsNetworkMismatch(txChainId); @@ -277,13 +276,13 @@ export const MismatchButton = forwardRef< }} onCloseModal={() => setDialog(undefined)} isLoggedIn={props.isLoggedIn} - client={client} + client={props.client} /> )} {dialog === "pay" && ( {props.chain.id === localhost.id ? ( // localhost case - + ) : chainWithServiceInfoQuery.data.testnet ? ( // faucet case { +const GetLocalHostTestnetFunds = (props: { client: ThirdwebClient }) => { const address = useActiveAccount()?.address; - const client = useThirdwebClient(); const requestFunds = async () => { if (!address) { return toast.error("No active account detected"); } const faucet = privateKeyToAccount({ privateKey: LOCAL_NODE_PKEY, - client, + client: props.client, }); const transaction = prepareTransaction({ to: address, chain: localhost, - client, + client: props.client, value: toWei("10"), }); const promise = sendTransaction({ diff --git a/apps/dashboard/src/components/buttons/TransactionButton.stories.tsx b/apps/dashboard/src/components/buttons/TransactionButton.stories.tsx index e7061d8ba53..2767611df94 100644 --- a/apps/dashboard/src/components/buttons/TransactionButton.stories.tsx +++ b/apps/dashboard/src/components/buttons/TransactionButton.stories.tsx @@ -190,6 +190,7 @@ function Variant(props: { return ( & { variant?: "destructive" | "primary" | "default"; isLoggedIn: boolean; checkBalance?: boolean; + client: ThirdwebClient; }; export const TransactionButton: React.FC = ({ @@ -40,6 +42,7 @@ export const TransactionButton: React.FC = ({ variant, isLoggedIn, checkBalance, + client, ...restButtonProps }) => { const activeWallet = useActiveWallet(); @@ -64,6 +67,7 @@ export const TransactionButton: React.FC = ({ = ( Simulate Promise; chainId: number; + client: ThirdwebClient; } type BatchLazyMintProps = BatchLazyMintEVMProps; @@ -262,6 +264,7 @@ export const BatchLazyMint: ComponentWithChildren<