-
diff --git a/packages/frontend/src/pages/create-with-template-id/index.tsx b/packages/frontend/src/pages/create-with-template-id/index.tsx
index 56df50abf..9c831608c 100644
--- a/packages/frontend/src/pages/create-with-template-id/index.tsx
+++ b/packages/frontend/src/pages/create-with-template-id/index.tsx
@@ -6,14 +6,27 @@ import {
} from "@carrot-kpi/react";
import { useLocation, useNavigate, useParams } from "react-router-dom";
import { useTranslation } from "react-i18next";
-import { useAccount, useNetwork, usePublicClient } from "wagmi";
-import { Fetcher, ResolvedTemplate } from "@carrot-kpi/sdk";
+import {
+ useAccount,
+ useNetwork,
+ usePublicClient,
+ type Address,
+ useContractRead,
+} from "wagmi";
+import {
+ CHAIN_ADDRESSES,
+ ChainId,
+ FACTORY_ABI,
+ Fetcher,
+ ResolvedTemplate,
+} from "@carrot-kpi/sdk";
import { ErrorFeedback, Loader } from "@carrot-kpi/ui";
import { useAddTransaction } from "../../hooks/useAddTransaction";
import { Authenticate } from "../../components/authenticate";
import { useIsPinningProxyAuthenticated } from "../../hooks/useIsPinningProxyAuthenticated";
import { useInvalidateLatestKPITokens } from "../../hooks/useInvalidateLatestKPITokens";
import { Layout } from "../../components/layout";
+import { Permissioned } from "../../components/permissioned";
export const CreateWithTemplateId = () => {
const { i18n, t } = useTranslation();
@@ -111,6 +124,15 @@ export const CreateWithTemplateId = () => {
templateId,
]);
+ const { data: creatorAllowed, isLoading: loadingCreatorAllowed } =
+ useContractRead({
+ address: CHAIN_ADDRESSES[chain?.id as ChainId].factory,
+ abi: FACTORY_ABI,
+ functionName: "creatorAllowed",
+ args: [address as Address],
+ enabled: !!chain?.id && !!address,
+ });
+
const handleCreate = useCallback(() => {
invalidateLatestKPITokens();
}, [invalidateLatestKPITokens]);
@@ -121,15 +143,19 @@ export const CreateWithTemplateId = () => {
return (
-
- {!pinningProxyAuthenticated ? (
-
- ) : loading ? (
+
+ {loading || loadingCreatorAllowed ? (
+ ) : !creatorAllowed ? (
+
+ ) : !pinningProxyAuthenticated ? (
+
) : template ? (