Compare commits
55
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8910f55ca2 | ||
|
|
b237318b7d | ||
|
|
082d9630f4 | ||
|
|
d4bc8e199d | ||
|
|
4edf1ebe95 | ||
|
|
b12725b231 | ||
|
|
3d1c321bd6 | ||
|
|
810ec6efa7 | ||
|
|
1c6ed9bd0d | ||
|
|
82035fd0b7 | ||
|
|
8b324597fb | ||
|
|
5ebb7549ca | ||
|
|
dfe4cf0928 | ||
|
|
6cce31d828 | ||
|
|
aaad876a6f | ||
|
|
de297e4c97 | ||
|
|
2114e5f91f | ||
|
|
ca0841745a | ||
|
|
d150ea1c91 | ||
|
|
f1479b85f0 | ||
|
|
283dc289fc | ||
|
|
8abf3cc777 | ||
|
|
f10fbc8383 | ||
|
|
38627d352b | ||
|
|
ad8cc9a1d2 | ||
|
|
4e935392fa | ||
|
|
f44d6ba282 | ||
|
|
3678054931 | ||
|
|
196cb54ae9 | ||
|
|
ed2d64197d | ||
|
|
e141e11ff3 | ||
|
|
6ae54ddd98 | ||
|
|
8245c06b3e | ||
|
|
1c11f84481 | ||
|
|
b84db126d7 | ||
|
|
a4406214c6 | ||
|
|
02627631b6 | ||
|
|
913b243147 | ||
|
|
3edbe2898c | ||
|
|
926dad4556 | ||
|
|
0639d0d9ea | ||
|
|
4fed9f4593 | ||
|
|
f2e8b9ecab | ||
|
|
523412437b | ||
|
|
ac4ade6262 | ||
|
|
819ce86c61 | ||
|
|
86fd445276 | ||
|
|
55fba51dab | ||
|
|
7c95211b98 | ||
|
|
3bb1fe0e1f | ||
|
|
a1aba2989e | ||
|
|
deeca886a4 | ||
|
|
31c4bb22fc | ||
|
|
3b1e16c8b7 | ||
|
|
1f42ad2a2d |
@@ -16,6 +16,7 @@ yalc.lock
|
||||
./build/
|
||||
playwright-report/
|
||||
.env/
|
||||
.pnpm-store/
|
||||
|
||||
# codecov binary
|
||||
codecov
|
||||
|
||||
@@ -12,7 +12,7 @@ import type { WalletNFT } from "lib/wallet/nfts/types";
|
||||
import { getVercelEnv } from "../../lib/vercel-utils";
|
||||
import { isAlchemySupported } from "../../lib/wallet/nfts/isAlchemySupported";
|
||||
import { isMoralisSupported } from "../../lib/wallet/nfts/isMoralisSupported";
|
||||
import { NET_PUBLIC_DASHBOARD_THIRDWEB_CLIENT_ID } from "../constants/public-envs";
|
||||
import { NEXT_PUBLIC_DASHBOARD_CLIENT_ID } from "../constants/public-envs";
|
||||
import { MORALIS_API_KEY } from "../constants/server-envs";
|
||||
|
||||
type WalletNFTApiReturn =
|
||||
@@ -149,7 +149,7 @@ async function getWalletNFTsFromInsight(params: {
|
||||
|
||||
const response = await fetch(url, {
|
||||
headers: {
|
||||
"x-client-id": NET_PUBLIC_DASHBOARD_THIRDWEB_CLIENT_ID,
|
||||
"x-client-id": NEXT_PUBLIC_DASHBOARD_CLIENT_ID,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -59,3 +59,16 @@ export async function getTeamInvoices(
|
||||
throw new Error("Failed to fetch billing history");
|
||||
}
|
||||
}
|
||||
|
||||
async function getStripeCustomer(customerId: string) {
|
||||
return await getStripe().customers.retrieve(customerId);
|
||||
}
|
||||
|
||||
export async function getStripeBalance(customerId: string) {
|
||||
const customer = await getStripeCustomer(customerId);
|
||||
if (customer.deleted) {
|
||||
return 0;
|
||||
}
|
||||
// Stripe returns a positive balance for credits, so we need to divide by -100 to get the actual balance (as long as the balance is not 0)
|
||||
return customer.balance === 0 ? 0 : customer.balance / -100;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import "server-only";
|
||||
import type {
|
||||
AnalyticsQueryParams,
|
||||
EcosystemWalletStats,
|
||||
EngineCloudStats,
|
||||
InAppWalletStats,
|
||||
RpcMethodStats,
|
||||
TransactionStats,
|
||||
@@ -425,9 +426,30 @@ export async function getUniversalBridgeWalletUsage(args: {
|
||||
console.error(
|
||||
`Failed to fetch universal bridge wallet stats: ${res?.status} - ${res.statusText} - ${reason}`,
|
||||
);
|
||||
return null;
|
||||
return [];
|
||||
}
|
||||
|
||||
const json = await res.json();
|
||||
return json.data as UniversalBridgeWalletStats[];
|
||||
}
|
||||
|
||||
export async function getEngineCloudMethodUsage(
|
||||
params: AnalyticsQueryParams,
|
||||
): Promise<EngineCloudStats[]> {
|
||||
const searchParams = buildSearchParams(params);
|
||||
const res = await fetchAnalytics(
|
||||
`v2/engine-cloud/requests?${searchParams.toString()}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
},
|
||||
);
|
||||
|
||||
if (res?.status !== 200) {
|
||||
console.error("Failed to fetch Engine Cloud method usage");
|
||||
return [];
|
||||
}
|
||||
|
||||
const json = await res.json();
|
||||
return json.data as EngineCloudStats[];
|
||||
}
|
||||
|
||||
@@ -67,6 +67,10 @@ interface TestWebhookResponse {
|
||||
error?: string;
|
||||
}
|
||||
|
||||
type SupportedWebhookChainsResponse =
|
||||
| { chains: Array<number> }
|
||||
| { error: string };
|
||||
|
||||
export async function createWebhook(
|
||||
payload: CreateWebhookPayload,
|
||||
clientId: string,
|
||||
@@ -205,3 +209,31 @@ export async function testWebhook(
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getSupportedWebhookChains(): Promise<SupportedWebhookChainsResponse> {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`https://${THIRDWEB_INSIGHT_API_DOMAIN}/service/chains`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
"x-service-api-key": process.env.INSIGHT_SERVICE_API_KEY || "",
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
const errorText = await response.json();
|
||||
return { error: `Failed to fetch supported chains: ${errorText.error}` };
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
if (Array.isArray(data.data)) {
|
||||
return { chains: data.data };
|
||||
}
|
||||
return { error: "Unexpected response format" };
|
||||
} catch (error) {
|
||||
console.error("Error fetching supported chains:", error);
|
||||
return { error: `Failed to fetch supported chains: ${error}` };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ type PaymentLink = {
|
||||
chainId: number;
|
||||
};
|
||||
amount: bigint | undefined;
|
||||
purchaseData: unknown;
|
||||
purchaseData: Record<string, unknown> | undefined;
|
||||
};
|
||||
|
||||
export async function getPaymentLink(props: {
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
import { MultiSelect } from "@/components/blocks/multi-select";
|
||||
import { SelectWithSearch } from "@/components/blocks/select-with-search";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { ChainIconClient } from "components/icons/ChainIcon";
|
||||
import { useAllChainsData } from "hooks/chains/allChains";
|
||||
import { useCallback, useMemo } from "react";
|
||||
import type { ThirdwebClient } from "thirdweb";
|
||||
import { ChainIconClient } from "../../../components/icons/ChainIcon";
|
||||
import { useAllChainsData } from "../../../hooks/chains/allChains";
|
||||
|
||||
function cleanChainName(chainName: string) {
|
||||
return chainName.replace("Mainnet", "");
|
||||
@@ -27,8 +27,15 @@ export function MultiNetworkSelector(props: {
|
||||
side?: "left" | "right" | "top" | "bottom";
|
||||
showSelectedValuesInModal?: boolean;
|
||||
client: ThirdwebClient;
|
||||
chainIds?: number[];
|
||||
}) {
|
||||
const { allChains, idToChain } = useAllChainsData();
|
||||
let { allChains, idToChain } = useAllChainsData();
|
||||
|
||||
if (props.chainIds && props.chainIds.length > 0) {
|
||||
allChains = allChains.filter((chain) =>
|
||||
props.chainIds?.includes(chain.chainId),
|
||||
);
|
||||
}
|
||||
|
||||
const options = useMemo(() => {
|
||||
let sortedChains = allChains;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { useAllChainsData } from "hooks/chains/allChains";
|
||||
import { useTokensData } from "hooks/tokens/tokens";
|
||||
import { useCallback, useMemo } from "react";
|
||||
import {
|
||||
NATIVE_TOKEN_ADDRESS,
|
||||
@@ -5,8 +7,6 @@ import {
|
||||
getAddress,
|
||||
} from "thirdweb";
|
||||
import { shortenAddress } from "thirdweb/utils";
|
||||
import { useAllChainsData } from "../../../hooks/chains/allChains";
|
||||
import { useTokensData } from "../../../hooks/tokens/tokens";
|
||||
import { replaceIpfsUrl } from "../../../lib/sdk";
|
||||
import { fallbackChainIcon } from "../../../utils/chain-icons";
|
||||
import type { TokenMetadata } from "../../api/universal-bridge/tokens";
|
||||
|
||||
@@ -41,6 +41,7 @@ type UpsellBannerCardProps = {
|
||||
cta: {
|
||||
text: React.ReactNode;
|
||||
icon?: React.ReactNode;
|
||||
target?: "_blank";
|
||||
link: string;
|
||||
};
|
||||
trackingCategory: string;
|
||||
@@ -55,7 +56,7 @@ export function UpsellBannerCard(props: UpsellBannerCardProps) {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"relative overflow-hidden rounded-lg border bg-gradient-to-r p-5",
|
||||
"relative overflow-hidden rounded-lg border bg-gradient-to-r p-4 lg:p-6",
|
||||
color.border,
|
||||
color.bgFrom,
|
||||
)}
|
||||
@@ -73,7 +74,7 @@ export function UpsellBannerCard(props: UpsellBannerCardProps) {
|
||||
{props.icon ? (
|
||||
<div
|
||||
className={cn(
|
||||
"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-full",
|
||||
"mt-0.5 hidden h-9 w-9 shrink-0 items-center justify-center rounded-full lg:flex",
|
||||
color.iconBg,
|
||||
)}
|
||||
>
|
||||
@@ -90,9 +91,7 @@ export function UpsellBannerCard(props: UpsellBannerCardProps) {
|
||||
>
|
||||
{props.title}
|
||||
</h3>
|
||||
<p className={cn("mt-0.5 text-sm", color.desc)}>
|
||||
{props.description}
|
||||
</p>
|
||||
<p className={cn("text-sm", color.desc)}>{props.description}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -108,6 +107,7 @@ export function UpsellBannerCard(props: UpsellBannerCardProps) {
|
||||
href={props.cta.link}
|
||||
category={props.trackingCategory}
|
||||
label={props.trackingLabel}
|
||||
target={props.cta.target}
|
||||
>
|
||||
{props.cta.text}
|
||||
{props.cta.icon && <span className="ml-2">{props.cta.icon}</span>}
|
||||
|
||||
@@ -15,14 +15,14 @@ import {
|
||||
ChartTooltip,
|
||||
ChartTooltipContent,
|
||||
} from "@/components/ui/chart";
|
||||
import { formatDate } from "date-fns";
|
||||
import { useMemo } from "react";
|
||||
import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from "recharts";
|
||||
import { cn } from "@/lib/utils";
|
||||
import {
|
||||
EmptyChartState,
|
||||
LoadingChartState,
|
||||
} from "../../../../components/analytics/empty-chart-state";
|
||||
import { cn } from "../../../lib/utils";
|
||||
} from "components/analytics/empty-chart-state";
|
||||
import { formatDate } from "date-fns";
|
||||
import { useMemo } from "react";
|
||||
import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from "recharts";
|
||||
|
||||
type ThirdwebAreaChartProps<TConfig extends ChartConfig> = {
|
||||
header?: {
|
||||
@@ -46,8 +46,12 @@ type ThirdwebAreaChartProps<TConfig extends ChartConfig> = {
|
||||
// chart className
|
||||
chartClassName?: string;
|
||||
isPending: boolean;
|
||||
className?: string;
|
||||
cardContentClassName?: string;
|
||||
hideLabel?: boolean;
|
||||
toolTipLabelFormatter?: (label: string, payload: unknown) => React.ReactNode;
|
||||
toolTipValueFormatter?: (value: unknown) => React.ReactNode;
|
||||
emptyChartState?: React.ReactElement;
|
||||
};
|
||||
|
||||
export function ThirdwebAreaChart<TConfig extends ChartConfig>(
|
||||
@@ -56,7 +60,7 @@ export function ThirdwebAreaChart<TConfig extends ChartConfig>(
|
||||
const configKeys = useMemo(() => Object.keys(props.config), [props.config]);
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<Card className={props.className}>
|
||||
{props.header && (
|
||||
<CardHeader>
|
||||
<CardTitle className={cn("mb-2", props.header.titleClassName)}>
|
||||
@@ -70,12 +74,16 @@ export function ThirdwebAreaChart<TConfig extends ChartConfig>(
|
||||
|
||||
{props.customHeader && props.customHeader}
|
||||
|
||||
<CardContent className={cn(!props.header && "pt-6")}>
|
||||
<CardContent
|
||||
className={cn(!props.header && "pt-6", props.cardContentClassName)}
|
||||
>
|
||||
<ChartContainer config={props.config} className={props.chartClassName}>
|
||||
{props.isPending ? (
|
||||
<LoadingChartState />
|
||||
) : props.data.length === 0 ? (
|
||||
<EmptyChartState />
|
||||
<EmptyChartState type="area">
|
||||
{props.emptyChartState}
|
||||
</EmptyChartState>
|
||||
) : (
|
||||
<AreaChart accessibilityLayer data={props.data}>
|
||||
<CartesianGrid vertical={false} />
|
||||
@@ -100,6 +108,7 @@ export function ThirdwebAreaChart<TConfig extends ChartConfig>(
|
||||
props.hideLabel !== undefined ? props.hideLabel : true
|
||||
}
|
||||
labelFormatter={props.toolTipLabelFormatter}
|
||||
valueFormatter={props.toolTipValueFormatter}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -17,13 +17,13 @@ import {
|
||||
ChartTooltip,
|
||||
ChartTooltipContent,
|
||||
} from "@/components/ui/chart";
|
||||
import { formatDate } from "date-fns";
|
||||
import { useMemo } from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
import {
|
||||
EmptyChartState,
|
||||
LoadingChartState,
|
||||
} from "../../../../components/analytics/empty-chart-state";
|
||||
import { cn } from "../../../lib/utils";
|
||||
} from "components/analytics/empty-chart-state";
|
||||
import { formatDate } from "date-fns";
|
||||
import { useMemo } from "react";
|
||||
|
||||
type ThirdwebBarChartProps<TConfig extends ChartConfig> = {
|
||||
// metadata
|
||||
@@ -75,7 +75,9 @@ export function ThirdwebBarChart<TConfig extends ChartConfig>(
|
||||
{props.isPending ? (
|
||||
<LoadingChartState />
|
||||
) : props.data.length === 0 ? (
|
||||
<EmptyChartState>{props.emptyChartState}</EmptyChartState>
|
||||
<EmptyChartState type="bar">
|
||||
{props.emptyChartState}
|
||||
</EmptyChartState>
|
||||
) : (
|
||||
<BarChart accessibilityLayer data={props.data}>
|
||||
<CartesianGrid vertical={false} />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useLocalStorage } from "hooks/useLocalStorage";
|
||||
import { XIcon } from "lucide-react";
|
||||
import { useLocalStorage } from "../../../hooks/useLocalStorage";
|
||||
import { Button } from "../ui/button";
|
||||
|
||||
export function DismissibleAlert(props: {
|
||||
|
||||
@@ -10,6 +10,7 @@ type DistributionBarChartProps = {
|
||||
segments: Segment[];
|
||||
title: string;
|
||||
};
|
||||
|
||||
export function DistributionBarChart(props: DistributionBarChartProps) {
|
||||
const totalPercentage = props.segments.reduce(
|
||||
(sum, segment) => sum + segment.percent,
|
||||
@@ -59,7 +60,13 @@ export function DistributionBarChart(props: DistributionBarChartProps) {
|
||||
backgroundColor: segment.color,
|
||||
}}
|
||||
/>
|
||||
<p className="text-sm">
|
||||
<p
|
||||
className={cn(
|
||||
"text-sm",
|
||||
(segment.percent > 100 || segment.percent < 0) &&
|
||||
"text-destructive-text",
|
||||
)}
|
||||
>
|
||||
{segment.label}: {segment.percent}%
|
||||
</p>
|
||||
</div>
|
||||
|
||||
+5
-10
@@ -22,41 +22,36 @@ export const AllStates: Story = {
|
||||
args: {
|
||||
steps: [
|
||||
{
|
||||
status: "completed",
|
||||
status: { type: "completed" },
|
||||
label: "Connect Wallet",
|
||||
retryLabel: "Failed to connect wallet",
|
||||
execute: async () => {
|
||||
await sleep(1000);
|
||||
},
|
||||
},
|
||||
{
|
||||
status: "pending",
|
||||
status: { type: "pending" },
|
||||
label: "Sign Message",
|
||||
retryLabel: "Failed to sign message",
|
||||
execute: async () => {
|
||||
await sleep(1000);
|
||||
},
|
||||
},
|
||||
{
|
||||
status: "error",
|
||||
status: { type: "error", message: "This is an error message" },
|
||||
label: "Approve Transaction",
|
||||
retryLabel: "Transaction approval failed",
|
||||
execute: async () => {
|
||||
await sleep(1000);
|
||||
},
|
||||
},
|
||||
{
|
||||
status: "idle",
|
||||
status: { type: "idle" },
|
||||
label: "Confirm Transaction",
|
||||
retryLabel: "Transaction confirmation failed",
|
||||
execute: async () => {
|
||||
await sleep(1000);
|
||||
},
|
||||
},
|
||||
{
|
||||
status: "idle",
|
||||
status: { type: "idle" },
|
||||
label: "Finalize",
|
||||
retryLabel: "Finalization failed",
|
||||
execute: async () => {
|
||||
await sleep(1000);
|
||||
},
|
||||
|
||||
@@ -11,8 +11,14 @@ import { DynamicHeight } from "../../ui/DynamicHeight";
|
||||
import { Spinner } from "../../ui/Spinner/Spinner";
|
||||
|
||||
export type MultiStepState = {
|
||||
status: "idle" | "pending" | "completed" | "error";
|
||||
retryLabel: string;
|
||||
status:
|
||||
| {
|
||||
type: "idle" | "pending" | "completed";
|
||||
}
|
||||
| {
|
||||
type: "error";
|
||||
message: string | React.ReactNode;
|
||||
};
|
||||
label: string;
|
||||
execute: () => Promise<void>;
|
||||
};
|
||||
@@ -25,11 +31,11 @@ export function MultiStepStatus(props: {
|
||||
<div className="space-y-4">
|
||||
{props.steps.map((step) => (
|
||||
<div key={step.label} className="flex items-start space-x-3 ">
|
||||
{step.status === "completed" ? (
|
||||
{step.status.type === "completed" ? (
|
||||
<CircleCheckIcon className="mt-0.5 size-5 flex-shrink-0 text-green-500" />
|
||||
) : step.status === "pending" ? (
|
||||
) : step.status.type === "pending" ? (
|
||||
<Spinner className="mt-0.5 size-5 flex-shrink-0 text-foreground" />
|
||||
) : step.status === "error" ? (
|
||||
) : step.status.type === "error" ? (
|
||||
<AlertCircleIcon className="mt-0.5 size-5 flex-shrink-0 text-red-500" />
|
||||
) : (
|
||||
<CircleIcon className="mt-0.5 size-5 flex-shrink-0 text-muted-foreground/70" />
|
||||
@@ -37,11 +43,11 @@ export function MultiStepStatus(props: {
|
||||
<div className="flex-1">
|
||||
<p
|
||||
className={`font-medium ${
|
||||
step.status === "pending"
|
||||
step.status.type === "pending"
|
||||
? "text-foreground"
|
||||
: step.status === "completed"
|
||||
: step.status.type === "completed"
|
||||
? "text-green-500"
|
||||
: step.status === "error"
|
||||
: step.status.type === "error"
|
||||
? "text-red-500"
|
||||
: "text-muted-foreground/70"
|
||||
}`}
|
||||
@@ -49,9 +55,11 @@ export function MultiStepStatus(props: {
|
||||
{step.label}
|
||||
</p>
|
||||
|
||||
{step.status === "error" && (
|
||||
{step.status.type === "error" && (
|
||||
<div className="mt-1 space-y-2">
|
||||
<p className="mb-1 text-red-500 text-sm">{step.retryLabel}</p>
|
||||
<p className="mb-1 text-red-500 text-sm">
|
||||
{step.status.message}
|
||||
</p>
|
||||
<Button
|
||||
variant="destructive"
|
||||
size="sm"
|
||||
|
||||
@@ -4,13 +4,13 @@ import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ToolTipLabel } from "@/components/ui/tooltip";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { CheckIcon, CircleDollarSignIcon } from "lucide-react";
|
||||
import { RenewSubscriptionButton } from "components/settings/Account/Billing/renew-subscription/renew-subscription-button";
|
||||
import { useTrack } from "hooks/analytics/useTrack";
|
||||
import { CheckIcon, DollarSignIcon } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import type React from "react";
|
||||
import { remainingDays } from "utils/date-utils";
|
||||
import { TEAM_PLANS } from "utils/pricing";
|
||||
import { RenewSubscriptionButton } from "../../../components/settings/Account/Billing/renew-subscription/renew-subscription-button";
|
||||
import { useTrack } from "../../../hooks/analytics/useTrack";
|
||||
import { remainingDays } from "../../../utils/date-utils";
|
||||
import type { ProductSKU } from "../../lib/billing";
|
||||
import { CheckoutButton } from "../billing";
|
||||
|
||||
@@ -105,9 +105,12 @@ export const PricingCard: React.FC<PricingCardProps> = ({
|
||||
|
||||
{/* Price */}
|
||||
<div className="flex flex-col gap-0.5">
|
||||
{plan.isStartingPriceOnly && (
|
||||
<span className="text-muted-foreground text-xs">Starting at</span>
|
||||
)}
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="font-semibold text-2xl text-foreground tracking-tight">
|
||||
${plan.price}
|
||||
${plan.price.toLocaleString()}
|
||||
</span>
|
||||
|
||||
{!isCustomPrice && (
|
||||
@@ -183,10 +186,10 @@ const billingPlanToSkuMap: Record<Team["billingPlan"], ProductSKU | undefined> =
|
||||
{
|
||||
starter: "plan:starter",
|
||||
growth: "plan:growth",
|
||||
accelerate: "plan:accelerate",
|
||||
scale: "plan:scale",
|
||||
pro: "plan:pro",
|
||||
// we can't render checkout buttons for these plans:
|
||||
pro: undefined,
|
||||
accelerate: undefined,
|
||||
free: undefined,
|
||||
growth_legacy: undefined,
|
||||
starter_legacy: undefined,
|
||||
@@ -201,16 +204,19 @@ function FeatureItem({ text }: FeatureItemProps) {
|
||||
|
||||
return (
|
||||
<div className="flex items-center gap-2 text-sm">
|
||||
<CheckIcon className="size-4 shrink-0 text-green-500" />
|
||||
{Array.isArray(text) ? (
|
||||
<ToolTipLabel label={text[1]}>
|
||||
<DollarSignIcon className="size-4 shrink-0 text-green-500" />
|
||||
</ToolTipLabel>
|
||||
) : (
|
||||
<CheckIcon className="size-4 shrink-0 text-green-500" />
|
||||
)}
|
||||
{Array.isArray(text) ? (
|
||||
<div className="flex items-center gap-2">
|
||||
<p className="text-muted-foreground">
|
||||
{titleStr}{" "}
|
||||
<span className="text-muted-foreground md:hidden">{text[1]}</span>
|
||||
</p>
|
||||
<ToolTipLabel label={text[1]}>
|
||||
<CircleDollarSignIcon className="hidden size-4 text-muted-foreground md:block" />
|
||||
</ToolTipLabel>
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-muted-foreground">{titleStr}</p>
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
HoverCardContent,
|
||||
HoverCardTrigger,
|
||||
} from "@/components/ui/hover-card";
|
||||
import { useThirdwebClient } from "@/constants/thirdweb.client";
|
||||
import { resolveSchemeWithErrorHandler } from "@/lib/resolveSchemeWithErrorHandler";
|
||||
import { useClipboard } from "hooks/useClipboard";
|
||||
import { CheckIcon, CopyIcon, XIcon } from "lucide-react";
|
||||
@@ -24,8 +23,8 @@ export function WalletAddress(props: {
|
||||
shortenAddress?: boolean;
|
||||
className?: string;
|
||||
iconClassName?: string;
|
||||
client: ThirdwebClient;
|
||||
}) {
|
||||
const thirdwebClient = useThirdwebClient();
|
||||
// default back to zero address if no address provided
|
||||
const address = useMemo(() => props.address || ZERO_ADDRESS, [props.address]);
|
||||
|
||||
@@ -40,7 +39,7 @@ export function WalletAddress(props: {
|
||||
|
||||
const profiles = useSocialProfiles({
|
||||
address: address,
|
||||
client: thirdwebClient,
|
||||
client: props.client,
|
||||
});
|
||||
|
||||
const { onCopy, hasCopied } = useClipboard(address, 2000);
|
||||
@@ -78,7 +77,7 @@ export function WalletAddress(props: {
|
||||
<WalletAvatar
|
||||
address={address}
|
||||
profiles={profiles.data || []}
|
||||
thirdwebClient={thirdwebClient}
|
||||
thirdwebClient={props.client}
|
||||
iconClassName={props.iconClassName}
|
||||
/>
|
||||
)}
|
||||
@@ -122,7 +121,7 @@ export function WalletAddress(props: {
|
||||
) : (
|
||||
profiles.data?.map((profile) => {
|
||||
const walletAvatarLink = resolveSchemeWithErrorHandler({
|
||||
client: thirdwebClient,
|
||||
client: props.client,
|
||||
uri: profile.avatar,
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
export function LoadingDots() {
|
||||
return (
|
||||
<div className="fade-in-0 flex animate-in gap-2 duration-300">
|
||||
<span className="sr-only">Loading...</span>
|
||||
<div className="size-4 animate-bounce rounded-full bg-foreground [animation-delay:-0.3s]" />
|
||||
<div className="size-4 animate-bounce rounded-full bg-foreground [animation-delay:-0.15s]" />
|
||||
<div className="size-4 animate-bounce rounded-full bg-foreground" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import { cn } from "@/lib/utils";
|
||||
import { useTrack } from "hooks/analytics/useTrack";
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { useTrack } from "../../../hooks/analytics/useTrack";
|
||||
|
||||
export type NavButtonProps = {
|
||||
className?: string;
|
||||
|
||||
@@ -6,13 +6,17 @@ export type CodeProps = {
|
||||
code: string;
|
||||
lang: BundledLanguage;
|
||||
className?: string;
|
||||
ignoreFormattingErrors?: boolean;
|
||||
};
|
||||
|
||||
export const CodeServer: React.FC<CodeProps> = async ({
|
||||
code,
|
||||
lang,
|
||||
className,
|
||||
ignoreFormattingErrors,
|
||||
}) => {
|
||||
const { html, formattedCode } = await getCodeHtml(code, lang);
|
||||
const { html, formattedCode } = await getCodeHtml(code, lang, {
|
||||
ignoreFormattingErrors,
|
||||
});
|
||||
return <RenderCode code={formattedCode} html={html} className={className} />;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import { Input } from "./input";
|
||||
export function DecimalInput(props: {
|
||||
value: string;
|
||||
onChange: (value: string) => void;
|
||||
maxValue?: number;
|
||||
id?: string;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<Input
|
||||
id={props.id}
|
||||
type="text"
|
||||
value={props.value}
|
||||
className={props.className}
|
||||
inputMode="decimal"
|
||||
onChange={(e) => {
|
||||
const number = Number(e.target.value);
|
||||
// ignore if string becomes invalid number
|
||||
if (Number.isNaN(number)) {
|
||||
return;
|
||||
}
|
||||
if (props.maxValue && number > props.maxValue) {
|
||||
return;
|
||||
}
|
||||
// replace leading multiple zeros with single zero
|
||||
let cleanedValue = e.target.value.replace(/^0+/, "0");
|
||||
// replace leading zero before decimal point
|
||||
if (!cleanedValue.includes(".")) {
|
||||
cleanedValue = cleanedValue.replace(/^0+/, "");
|
||||
}
|
||||
props.onChange(cleanedValue || "0");
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -22,6 +22,7 @@ export function TabLinks(props: {
|
||||
tabContainerClassName?: string;
|
||||
shadowColor?: string;
|
||||
scrollableClassName?: string;
|
||||
bottomLineClassName?: string;
|
||||
}) {
|
||||
const { containerRef, lineRef, activeTabRef } =
|
||||
useUnderline<HTMLAnchorElement>();
|
||||
@@ -29,7 +30,12 @@ export function TabLinks(props: {
|
||||
return (
|
||||
<div className={cn("relative", props.className)}>
|
||||
{/* Bottom line */}
|
||||
<div className="absolute right-0 bottom-0 left-0 h-[1px] bg-border" />
|
||||
<div
|
||||
className={cn(
|
||||
"absolute right-0 bottom-0 left-0 h-[1px] bg-border",
|
||||
props.bottomLineClassName,
|
||||
)}
|
||||
/>
|
||||
|
||||
<ScrollShadow
|
||||
scrollableClassName={cn("pb-[8px] relative", props.scrollableClassName)}
|
||||
@@ -216,6 +222,7 @@ export function TabPathLinks(props: {
|
||||
tabContainerClassName?: string;
|
||||
shadowColor?: string;
|
||||
scrollableClassName?: string;
|
||||
bottomLineClassName?: string;
|
||||
}) {
|
||||
const pathname = usePathname() || "";
|
||||
const { links, ...restProps } = props;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export const NET_PUBLIC_DASHBOARD_THIRDWEB_CLIENT_ID =
|
||||
export const NEXT_PUBLIC_DASHBOARD_CLIENT_ID =
|
||||
process.env.NEXT_PUBLIC_DASHBOARD_CLIENT_ID || "";
|
||||
|
||||
export const NEXT_PUBLIC_NEBULA_APP_CLIENT_ID =
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useMemo } from "react";
|
||||
import { useActiveAccount } from "thirdweb/react";
|
||||
import type { GetAuthTokenResponse } from "../../app/(app)/api/auth/get-auth-token/route";
|
||||
import { LAST_USED_TEAM_ID } from "../../constants/cookies";
|
||||
import { getCookie } from "../../lib/cookie";
|
||||
import { getClientThirdwebClient } from "./thirdweb-client.client";
|
||||
|
||||
// returns a thirdweb client with optional JWT passed i
|
||||
|
||||
export function useThirdwebClient(jwt?: string) {
|
||||
const account = useActiveAccount();
|
||||
const lastUsedTeamId = getCookie(LAST_USED_TEAM_ID);
|
||||
|
||||
const query = useQuery({
|
||||
queryKey: ["jwt", account?.address],
|
||||
// only enable the query if there is an account and no JWT is passed in directly
|
||||
enabled: !!account && !jwt,
|
||||
retry: false,
|
||||
queryFn: async () => {
|
||||
if (!account) {
|
||||
throw new Error("No account");
|
||||
}
|
||||
const res = await fetch(
|
||||
`/api/auth/get-auth-token?address=${account.address}`,
|
||||
);
|
||||
if (!res.ok) {
|
||||
throw new Error("Failed to get auth token");
|
||||
}
|
||||
const json = (await res.json()) as GetAuthTokenResponse;
|
||||
if (!json.jwt) {
|
||||
throw new Error("No JWT in response");
|
||||
}
|
||||
return json.jwt;
|
||||
},
|
||||
});
|
||||
|
||||
return useMemo(
|
||||
// prefer jwt from props over the one from the token query if it exists
|
||||
() =>
|
||||
getClientThirdwebClient({
|
||||
jwt: jwt || query.data,
|
||||
teamId: lastUsedTeamId,
|
||||
}),
|
||||
[jwt, query.data, lastUsedTeamId],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT ADD ANYTHING TO THIS FILE IF YOU ARE NOT ABSOLUTELY SURE IT IS OK
|
||||
*/
|
||||
@@ -1,5 +1,5 @@
|
||||
import {
|
||||
NET_PUBLIC_DASHBOARD_THIRDWEB_CLIENT_ID,
|
||||
NEXT_PUBLIC_DASHBOARD_CLIENT_ID,
|
||||
NEXT_PUBLIC_IPFS_GATEWAY_URL,
|
||||
} from "@/constants/public-envs";
|
||||
import {
|
||||
@@ -42,10 +42,13 @@ export function getConfiguredThirdwebClient(options: {
|
||||
|
||||
if (!getTransactionDecorator()) {
|
||||
setTransactionDecorator(async ({ account, transaction }) => {
|
||||
// special override for sophon testnet (zk chain)
|
||||
// special override for sophon (zk chain)
|
||||
// sophon only allows transactions through their paymaster
|
||||
// so always use eip712 tx + paymaster
|
||||
if (transaction.chain.id === 531050104) {
|
||||
if (
|
||||
transaction.chain.id === 531050104 ||
|
||||
transaction.chain.id === 50104
|
||||
) {
|
||||
const serializedTx = await populateEip712Transaction({
|
||||
transaction,
|
||||
account,
|
||||
@@ -76,7 +79,7 @@ export function getConfiguredThirdwebClient(options: {
|
||||
return createThirdwebClient({
|
||||
teamId: options.teamId,
|
||||
secretKey: options.secretKey,
|
||||
clientId: NET_PUBLIC_DASHBOARD_THIRDWEB_CLIENT_ID,
|
||||
clientId: NEXT_PUBLIC_DASHBOARD_CLIENT_ID,
|
||||
config: {
|
||||
storage: {
|
||||
gatewayUrl: NEXT_PUBLIC_IPFS_GATEWAY_URL,
|
||||
|
||||
@@ -5,6 +5,7 @@ export type ProductSKU =
|
||||
| "plan:custom"
|
||||
| "plan:accelerate"
|
||||
| "plan:scale"
|
||||
| "plan:pro"
|
||||
| "product:ecosystem_wallets"
|
||||
| "product:engine_standard"
|
||||
| "product:engine_premium"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { differenceInCalendarDays } from "date-fns";
|
||||
import {
|
||||
type DurationId,
|
||||
type Range,
|
||||
getLastNDaysRange,
|
||||
} from "../../components/analytics/date-range-selector";
|
||||
} from "components/analytics/date-range-selector";
|
||||
import { differenceInCalendarDays } from "date-fns";
|
||||
|
||||
export function normalizeTime(date: Date) {
|
||||
const newDate = new Date(date);
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
"use client";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useThirdwebClient } from "@/constants/thirdweb.client";
|
||||
import { useStore } from "@/lib/reactive";
|
||||
import { getSDKTheme } from "app/(app)/components/sdk-component-theme";
|
||||
import { LazyConfigureNetworkModal } from "components/configure-networks/LazyConfigureNetworkModal";
|
||||
import { CustomChainRenderer } from "components/selects/CustomChainRenderer";
|
||||
import { mapV4ChainToV5Chain } from "contexts/map-chains";
|
||||
import { useTrack } from "hooks/analytics/useTrack";
|
||||
import { useAllChainsData } from "hooks/chains/allChains";
|
||||
import { useTheme } from "next-themes";
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { useCallback, useMemo, useState } from "react";
|
||||
import type { Chain } from "thirdweb";
|
||||
import type { Chain, ThirdwebClient } from "thirdweb";
|
||||
import {
|
||||
ConnectButton,
|
||||
type NetworkSelectorProps,
|
||||
@@ -21,8 +22,6 @@ import {
|
||||
} from "thirdweb/react";
|
||||
import { useFavoriteChainIds } from "../../../../app/(app)/(dashboard)/(chain)/components/client/star-button";
|
||||
import { doLogout } from "../../../../app/(app)/login/auth-actions";
|
||||
import { LazyConfigureNetworkModal } from "../../../../components/configure-networks/LazyConfigureNetworkModal";
|
||||
import { useAllChainsData } from "../../../../hooks/chains/allChains";
|
||||
import {
|
||||
type StoredChain,
|
||||
addRecentlyUsedChainId,
|
||||
@@ -36,9 +35,11 @@ export const CustomConnectWallet = (props: {
|
||||
signInLinkButtonClassName?: string;
|
||||
detailsButtonClassName?: string;
|
||||
chain?: Chain;
|
||||
client: ThirdwebClient;
|
||||
isLoggedIn: boolean;
|
||||
}) => {
|
||||
const thirdwebClient = useThirdwebClient();
|
||||
const client = props.client;
|
||||
|
||||
const loginRequired =
|
||||
props.loginRequired === undefined ? true : props.loginRequired;
|
||||
|
||||
@@ -140,7 +141,7 @@ export const CustomConnectWallet = (props: {
|
||||
<>
|
||||
<ConnectButton
|
||||
theme={getSDKTheme(t)}
|
||||
client={thirdwebClient}
|
||||
client={client}
|
||||
connectModal={{
|
||||
privacyPolicyUrl: "/privacy-policy",
|
||||
termsOfServiceUrl: "/terms",
|
||||
@@ -175,7 +176,7 @@ export const CustomConnectWallet = (props: {
|
||||
renderChain(props) {
|
||||
return (
|
||||
<CustomChainRenderer
|
||||
client={thirdwebClient}
|
||||
client={client}
|
||||
{...props}
|
||||
openEditChainModal={(c) => {
|
||||
setIsNetworkConfigModalOpen(true);
|
||||
@@ -197,6 +198,7 @@ export const CustomConnectWallet = (props: {
|
||||
open={isNetworkConfigModalOpen}
|
||||
onOpenChange={setIsNetworkConfigModalOpen}
|
||||
editChain={editChain}
|
||||
client={client}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
@@ -276,12 +278,11 @@ function ConnectWalletWelcomeScreen(props: {
|
||||
export function useCustomConnectModal() {
|
||||
const { connect } = useConnectModal();
|
||||
const { theme } = useTheme();
|
||||
const thirdwebClient = useThirdwebClient();
|
||||
|
||||
return useCallback(
|
||||
(options?: { chain?: Chain }) => {
|
||||
(options: { chain?: Chain; client: ThirdwebClient }) => {
|
||||
return connect({
|
||||
client: thirdwebClient,
|
||||
client: options.client,
|
||||
appMetadata: {
|
||||
name: "thirdweb",
|
||||
logoUrl: "https://thirdweb.com/favicon.ico",
|
||||
@@ -299,7 +300,7 @@ export function useCustomConnectModal() {
|
||||
theme: getSDKTheme(theme === "light" ? "light" : "dark"),
|
||||
});
|
||||
},
|
||||
[connect, theme, thirdwebClient],
|
||||
[connect, theme],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { apiServerProxy } from "@/actions/proxies";
|
||||
import type { Project } from "@/api/projects";
|
||||
import type { Team } from "@/api/team";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { useActiveAccount } from "thirdweb/react";
|
||||
import { accountKeys, authorizedWallets } from "../cache-keys";
|
||||
@@ -188,7 +187,7 @@ export function useUpdateNotifications() {
|
||||
export const verifyEmailClient = async (input: ConfirmEmailInput) => {
|
||||
type Result = {
|
||||
error?: { message: string };
|
||||
data: { team: Team; account: Account };
|
||||
data: { account: Account };
|
||||
};
|
||||
|
||||
const res = await apiServerProxy<Result>({
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
import { useThirdwebClient } from "@/constants/thirdweb.client";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import type { ThirdwebClient } from "thirdweb";
|
||||
import { upload } from "thirdweb/storage";
|
||||
|
||||
type DashboardUploadOptions = {
|
||||
uploadWithoutDirectory?: boolean;
|
||||
metadata?: Record<string, string>;
|
||||
client: ThirdwebClient;
|
||||
};
|
||||
|
||||
export function useDashboardStorageUpload(options?: DashboardUploadOptions) {
|
||||
const thirdwebClient = useThirdwebClient();
|
||||
export function useDashboardStorageUpload(options: DashboardUploadOptions) {
|
||||
return useMutation({
|
||||
mutationFn: async (files: Array<File | string>): Promise<string[]> => {
|
||||
const uris = await upload({
|
||||
client: thirdwebClient,
|
||||
files,
|
||||
...options,
|
||||
});
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TeamHeader } from "../../team/components/TeamHeader/team-header";
|
||||
|
||||
export default function Layout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<div className="flex grow flex-col">
|
||||
<div className="border-border border-b bg-card">
|
||||
<TeamHeader />
|
||||
</div>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+1
-1
@@ -1,8 +1,8 @@
|
||||
import { Card, CardContent, CardHeader } from "@/components/ui/card";
|
||||
import { serverThirdwebClient } from "@/constants/thirdweb-client.server";
|
||||
import { resolveSchemeWithErrorHandler } from "@/lib/resolveSchemeWithErrorHandler";
|
||||
import { defineChain } from "thirdweb";
|
||||
import { getChainMetadata } from "thirdweb/chains";
|
||||
import { serverThirdwebClient } from "../../../../../../../@/constants/thirdweb-client.server";
|
||||
|
||||
type RouteListCardProps = {
|
||||
originChainId: number;
|
||||
|
||||
+3
-2
@@ -23,7 +23,6 @@ import {
|
||||
NEXT_PUBLIC_THIRDWEB_ENGINE_FAUCET_WALLET,
|
||||
NEXT_PUBLIC_TURNSTILE_SITE_KEY,
|
||||
} from "@/constants/public-envs";
|
||||
import { useThirdwebClient } from "@/constants/thirdweb.client";
|
||||
import { CustomConnectWallet } from "@3rdweb-sdk/react/components/connect-wallet";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { Turnstile } from "@marsidev/react-turnstile";
|
||||
@@ -77,13 +76,14 @@ export function FaucetButton({
|
||||
chain,
|
||||
amount,
|
||||
isLoggedIn,
|
||||
client,
|
||||
}: {
|
||||
chain: ChainMetadata;
|
||||
amount: number;
|
||||
isLoggedIn: boolean;
|
||||
client: ThirdwebClient;
|
||||
}) {
|
||||
const pathname = usePathname();
|
||||
const client = useThirdwebClient();
|
||||
const address = useActiveAccount()?.address;
|
||||
const chainId = chain.chainId;
|
||||
// do not include local overrides for chain pages
|
||||
@@ -407,6 +407,7 @@ function SendFundsToFaucetModalContent(props: {
|
||||
isLoggedIn={props.isLoggedIn}
|
||||
connectButtonClassName="!w-full"
|
||||
detailsButtonClassName="!w-full"
|
||||
client={props.client}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
+7
-4
@@ -1,16 +1,19 @@
|
||||
"use client";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog";
|
||||
import { useThirdwebClient } from "@/constants/thirdweb.client";
|
||||
import { useTrack } from "hooks/analytics/useTrack";
|
||||
import { defineDashboardChain } from "lib/defineDashboardChain";
|
||||
import { useTheme } from "next-themes";
|
||||
import type { ThirdwebClient } from "thirdweb";
|
||||
import { PayEmbed } from "thirdweb/react";
|
||||
import { getSDKTheme } from "../../../../../../components/sdk-component-theme";
|
||||
|
||||
export function PayModalButton(props: { chainId: number; label: string }) {
|
||||
export function PayModalButton(props: {
|
||||
chainId: number;
|
||||
label: string;
|
||||
client: ThirdwebClient;
|
||||
}) {
|
||||
const { theme } = useTheme();
|
||||
const client = useThirdwebClient();
|
||||
const trackEvent = useTrack();
|
||||
return (
|
||||
<Dialog>
|
||||
@@ -35,7 +38,7 @@ export function PayModalButton(props: { chainId: number; label: string }) {
|
||||
dialogCloseClassName="focus:ring-0"
|
||||
>
|
||||
<PayEmbed
|
||||
client={client}
|
||||
client={props.client}
|
||||
theme={getSDKTheme(theme === "dark" ? "dark" : "light")}
|
||||
className="!w-auto"
|
||||
payOptions={{
|
||||
|
||||
+6
-2
@@ -6,7 +6,7 @@ import { ToolTipLabel } from "@/components/ui/tooltip";
|
||||
import { useCustomConnectModal } from "@3rdweb-sdk/react/components/connect-wallet";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { toast } from "sonner";
|
||||
import type { Chain } from "thirdweb";
|
||||
import type { Chain, ThirdwebClient } from "thirdweb";
|
||||
import {
|
||||
useActiveAccount,
|
||||
useActiveWalletChain,
|
||||
@@ -16,6 +16,7 @@ import { useDebounce } from "use-debounce";
|
||||
|
||||
type AddChainToWalletProps = {
|
||||
chain: Chain;
|
||||
client: ThirdwebClient;
|
||||
};
|
||||
|
||||
export const AddChainToWallet: React.FC<AddChainToWalletProps> = (props) => {
|
||||
@@ -49,7 +50,10 @@ export const AddChainToWallet: React.FC<AddChainToWalletProps> = (props) => {
|
||||
onClick={() => {
|
||||
// Connect directly to this chain
|
||||
if (!account) {
|
||||
return customConnectModal({ chain: props.chain });
|
||||
return customConnectModal({
|
||||
chain: props.chain,
|
||||
client: props.client,
|
||||
});
|
||||
}
|
||||
|
||||
// switch to this chain
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import { CopyTextButton } from "@/components/ui/CopyTextButton";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { ToolTipLabel } from "@/components/ui/tooltip";
|
||||
import { isProd } from "@/constants/env-utils";
|
||||
import { NET_PUBLIC_DASHBOARD_THIRDWEB_CLIENT_ID } from "@/constants/public-envs";
|
||||
import { NEXT_PUBLIC_DASHBOARD_CLIENT_ID } from "@/constants/public-envs";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { CircleCheckIcon, XIcon } from "lucide-react";
|
||||
import { hostnameEndsWith } from "utils/url";
|
||||
@@ -14,7 +14,7 @@ function useChainStatswithRPC(_rpcUrl: string) {
|
||||
let rpcUrl = _rpcUrl.replace(
|
||||
// eslint-disable-next-line no-template-curly-in-string
|
||||
"${THIRDWEB_API_KEY}",
|
||||
NET_PUBLIC_DASHBOARD_THIRDWEB_CLIENT_ID,
|
||||
NEXT_PUBLIC_DASHBOARD_CLIENT_ID,
|
||||
);
|
||||
|
||||
// based on the environment hit dev or production
|
||||
|
||||
+3
@@ -1,5 +1,6 @@
|
||||
import { ExternalLinkIcon } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import type { ThirdwebClient } from "thirdweb";
|
||||
import type { ChainMetadata } from "thirdweb/chains";
|
||||
import { ChainIcon } from "../../../../components/server/chain-icon";
|
||||
import { PayModalButton } from "../client/PayModal";
|
||||
@@ -8,6 +9,7 @@ import { SectionTitle } from "./SectionTitle";
|
||||
|
||||
export function BuyFundsSection(props: {
|
||||
chain: ChainMetadata;
|
||||
client: ThirdwebClient;
|
||||
}) {
|
||||
const sanitizedChainName = props.chain.name.replace("Mainnet", "").trim();
|
||||
|
||||
@@ -45,6 +47,7 @@ export function BuyFundsSection(props: {
|
||||
<PayModalButton
|
||||
chainId={props.chain.chainId}
|
||||
label={`Bridge to ${sanitizedChainName}`}
|
||||
client={props.client}
|
||||
/>
|
||||
|
||||
<div className="h-4" />
|
||||
|
||||
+4
-1
@@ -1,3 +1,4 @@
|
||||
import type { ThirdwebClient } from "thirdweb";
|
||||
import type { ChainMetadata } from "thirdweb/chains";
|
||||
import { getFaucetClaimAmount } from "../../../../../../api/testnet-faucet/claim/claim-amount";
|
||||
import { ChainIcon } from "../../../../components/server/chain-icon";
|
||||
@@ -8,8 +9,9 @@ import { SectionTitle } from "./SectionTitle";
|
||||
export async function FaucetSection(props: {
|
||||
chain: ChainMetadata;
|
||||
isLoggedIn: boolean;
|
||||
client: ThirdwebClient;
|
||||
}) {
|
||||
const { chain, isLoggedIn } = props;
|
||||
const { chain, isLoggedIn, client } = props;
|
||||
|
||||
// Check eligibility.
|
||||
const sanitizedChainName = chain.name.replace("Mainnet", "").trim();
|
||||
@@ -44,6 +46,7 @@ export async function FaucetSection(props: {
|
||||
<div className="h-8" />
|
||||
|
||||
<FaucetButton
|
||||
client={client}
|
||||
chain={chain}
|
||||
amount={amountToGive}
|
||||
isLoggedIn={isLoggedIn}
|
||||
|
||||
+3
@@ -1,6 +1,7 @@
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
import Link from "next/link";
|
||||
import type { ThirdwebClient } from "thirdweb";
|
||||
import type { ChainMetadata } from "thirdweb/chains";
|
||||
import { mapV4ChainToV5Chain } from "../../../../../../../../contexts/map-chains";
|
||||
import { ChainIcon } from "../../../../components/server/chain-icon";
|
||||
@@ -10,6 +11,7 @@ type ChainHeaderProps = {
|
||||
headerImageUrl?: string;
|
||||
logoUrl?: string;
|
||||
chain: ChainMetadata;
|
||||
client: ThirdwebClient;
|
||||
};
|
||||
|
||||
// TODO: improve the behavior when clicking "Get started with thirdweb", currently just redirects to the dashboard
|
||||
@@ -51,6 +53,7 @@ export function ChainHeader(props: ChainHeaderProps) {
|
||||
{/* Desktop only */}
|
||||
<div className="hidden flex-row gap-2 lg:flex">
|
||||
<AddChainToWallet
|
||||
client={props.client}
|
||||
chain={
|
||||
// Do not include chain overrides for chain pages
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
getAuthToken,
|
||||
getAuthTokenWalletAddress,
|
||||
} from "../../../../api/lib/getAuthToken";
|
||||
import { TeamHeader } from "../../../../team/components/TeamHeader/team-header";
|
||||
import { StarButton } from "../../components/client/star-button";
|
||||
import { getChain, getChainMetadata } from "../../utils";
|
||||
import { AddChainToWallet } from "./components/client/add-chain-to-wallet";
|
||||
@@ -95,7 +96,10 @@ The following is the user's message:
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="flex grow flex-col">
|
||||
<div className="border-border border-b bg-card">
|
||||
<TeamHeader />
|
||||
</div>
|
||||
<NebulaChatButton
|
||||
isLoggedIn={!!authToken}
|
||||
networks={chain.testnet ? "testnet" : "mainnet"}
|
||||
@@ -160,6 +164,7 @@ The following is the user's message:
|
||||
headerImageUrl={chainMetadata?.headerImgUrl}
|
||||
logoUrl={chain.icon?.url}
|
||||
chain={chain}
|
||||
client={client}
|
||||
/>
|
||||
|
||||
<div className="h-4 md:h-8" />
|
||||
@@ -206,6 +211,7 @@ The following is the user's message:
|
||||
<div className="w-full sm:hidden">
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<AddChainToWallet
|
||||
client={client}
|
||||
chain={
|
||||
// Do not include chain overrides for chain pages
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
@@ -225,7 +231,7 @@ The following is the user's message:
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { serverThirdwebClient } from "@/constants/thirdweb-client.server";
|
||||
import { ImageResponse } from "next/og";
|
||||
import { download } from "thirdweb/storage";
|
||||
import { fetchChain } from "utils/fetchChain";
|
||||
import { serverThirdwebClient } from "../../../../../../@/constants/thirdweb-client.server";
|
||||
|
||||
// Route segment config
|
||||
export const runtime = "edge";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
|
||||
import { CircleAlertIcon } from "lucide-react";
|
||||
import { getRawAccount } from "../../../../account/settings/getAccount";
|
||||
import { getChain, getChainMetadata } from "../../utils";
|
||||
@@ -16,6 +17,7 @@ export default async function Page(props: {
|
||||
const params = await props.params;
|
||||
const chain = await getChain(params.chain_id);
|
||||
const chainMetadata = await getChainMetadata(chain.chainId);
|
||||
const client = getClientThirdwebClient();
|
||||
const isDeprecated = chain.status === "deprecated";
|
||||
|
||||
const account = await getRawAccount();
|
||||
@@ -42,9 +44,9 @@ export default async function Page(props: {
|
||||
|
||||
{/* Faucet / Buy Funds */}
|
||||
{chain.testnet ? (
|
||||
<FaucetSection chain={chain} isLoggedIn={!!account} />
|
||||
<FaucetSection chain={chain} isLoggedIn={!!account} client={client} />
|
||||
) : chain.services.find((c) => c.service === "pay" && c.enabled) ? (
|
||||
<BuyFundsSection chain={chain} />
|
||||
<BuyFundsSection chain={chain} client={client} />
|
||||
) : null}
|
||||
|
||||
{/* Chain Overview */}
|
||||
|
||||
+1
@@ -30,6 +30,7 @@ export const CancelTab: React.FC<CancelTabProps> = ({
|
||||
return (
|
||||
<div className="flex flex-col gap-3 pt-3">
|
||||
<TransactionButton
|
||||
client={contract.client}
|
||||
isLoggedIn={isLoggedIn}
|
||||
txChainID={contract.chain.id}
|
||||
transactionCount={1}
|
||||
|
||||
+3
@@ -485,6 +485,7 @@ export const CreateListingsForm: React.FC<CreateListingsFormProps> = ({
|
||||
>
|
||||
<FormLabel>Contract address</FormLabel>
|
||||
<SolidityInput
|
||||
client={contract.client}
|
||||
solidityType="address"
|
||||
formContext={form}
|
||||
{...form.register("selected.contractAddress", {
|
||||
@@ -558,6 +559,7 @@ export const CreateListingsForm: React.FC<CreateListingsFormProps> = ({
|
||||
width="140px"
|
||||
height="140px"
|
||||
requireInteraction
|
||||
client={contract.client}
|
||||
/>
|
||||
</Box>
|
||||
</Tooltip>
|
||||
@@ -658,6 +660,7 @@ export const CreateListingsForm: React.FC<CreateListingsFormProps> = ({
|
||||
Cancel
|
||||
</Button>
|
||||
<TransactionButton
|
||||
client={contract.client}
|
||||
isLoggedIn={isLoggedIn}
|
||||
txChainID={contract.chain.id}
|
||||
isPending={isFormLoading}
|
||||
|
||||
+5
-1
@@ -51,6 +51,7 @@ export const ListingDrawer: React.FC<NFTDrawerProps> = ({
|
||||
<div className="flex flex-row gap-6">
|
||||
<NFTMediaWithEmptyState
|
||||
metadata={renderData.asset.metadata}
|
||||
client={contract.client}
|
||||
requireInteraction
|
||||
width="150px"
|
||||
height="150px"
|
||||
@@ -92,7 +93,10 @@ export const ListingDrawer: React.FC<NFTDrawerProps> = ({
|
||||
<p className="font-bold">Seller</p>
|
||||
</GridItem>
|
||||
<GridItem colSpan={9}>
|
||||
<WalletAddress address={renderData.creatorAddress} />
|
||||
<WalletAddress
|
||||
address={renderData.creatorAddress}
|
||||
client={contract.client}
|
||||
/>
|
||||
</GridItem>
|
||||
<GridItem colSpan={3}>
|
||||
<p className="font-bold">Listing ID</p>
|
||||
|
||||
+46
-44
@@ -40,49 +40,6 @@ import { min } from "thirdweb/utils";
|
||||
import { ListingDrawer } from "./listing-drawer";
|
||||
import { LISTING_STATUS } from "./types";
|
||||
|
||||
const tableColumns: Column<DirectListing | EnglishAuction>[] = [
|
||||
{
|
||||
Header: "Listing Id",
|
||||
accessor: (row) => row.id.toString(),
|
||||
},
|
||||
{
|
||||
Header: "Media",
|
||||
accessor: (row) => row.asset.metadata,
|
||||
// biome-ignore lint/suspicious/noExplicitAny: FIXME
|
||||
Cell: (cell: any) => <MediaCell cell={cell} />,
|
||||
},
|
||||
{
|
||||
Header: "Name",
|
||||
accessor: (row) => row.asset.metadata.name ?? "N/A",
|
||||
},
|
||||
{
|
||||
Header: "Creator",
|
||||
accessor: (row) => row.creatorAddress,
|
||||
// biome-ignore lint/suspicious/noExplicitAny: FIXME
|
||||
Cell: ({ cell }: { cell: Cell<any, string> }) => (
|
||||
<WalletAddress address={cell.value} />
|
||||
),
|
||||
},
|
||||
{
|
||||
Header: "Price",
|
||||
accessor: (row) =>
|
||||
(row as DirectListing)?.currencyValuePerToken ||
|
||||
(row as EnglishAuction)?.buyoutCurrencyValue,
|
||||
// biome-ignore lint/suspicious/noExplicitAny: FIXME
|
||||
Cell: ({ cell }: { cell: Cell<any, any> }) => {
|
||||
return (
|
||||
<p className="whitespace-nowrap text-muted-foreground">
|
||||
{cell.value.displayValue} {cell.value.symbol}
|
||||
</p>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
Header: "Status",
|
||||
accessor: (row) => LISTING_STATUS[row.status],
|
||||
},
|
||||
];
|
||||
|
||||
interface MarketplaceTableProps {
|
||||
contract: ThirdwebContract;
|
||||
getAllQueryResult: UseQueryResult<DirectListing[] | EnglishAuction[]>;
|
||||
@@ -132,6 +89,51 @@ export const MarketplaceTable: React.FC<MarketplaceTableProps> = ({
|
||||
return getValidQueryResult?.data || prevData;
|
||||
}, [getAllQueryResult, getValidQueryResult, listingsToShow, prevData]);
|
||||
|
||||
const tableColumns: Column<DirectListing | EnglishAuction>[] = useMemo(() => {
|
||||
return [
|
||||
{
|
||||
Header: "Listing Id",
|
||||
accessor: (row) => row.id.toString(),
|
||||
},
|
||||
{
|
||||
Header: "Media",
|
||||
accessor: (row) => row.asset.metadata,
|
||||
// biome-ignore lint/suspicious/noExplicitAny: FIXME
|
||||
Cell: (cell: any) => <MediaCell cell={cell} client={contract.client} />,
|
||||
},
|
||||
{
|
||||
Header: "Name",
|
||||
accessor: (row) => row.asset.metadata.name ?? "N/A",
|
||||
},
|
||||
{
|
||||
Header: "Creator",
|
||||
accessor: (row) => row.creatorAddress,
|
||||
// biome-ignore lint/suspicious/noExplicitAny: FIXME
|
||||
Cell: ({ cell }: { cell: Cell<any, string> }) => (
|
||||
<WalletAddress address={cell.value} client={contract.client} />
|
||||
),
|
||||
},
|
||||
{
|
||||
Header: "Price",
|
||||
accessor: (row) =>
|
||||
(row as DirectListing)?.currencyValuePerToken ||
|
||||
(row as EnglishAuction)?.buyoutCurrencyValue,
|
||||
// biome-ignore lint/suspicious/noExplicitAny: FIXME
|
||||
Cell: ({ cell }: { cell: Cell<any, any> }) => {
|
||||
return (
|
||||
<p className="whitespace-nowrap text-muted-foreground">
|
||||
{cell.value.displayValue} {cell.value.symbol}
|
||||
</p>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
Header: "Status",
|
||||
accessor: (row) => LISTING_STATUS[row.status],
|
||||
},
|
||||
];
|
||||
}, [contract.client]);
|
||||
|
||||
const {
|
||||
getTableProps,
|
||||
getTableBodyProps,
|
||||
@@ -235,7 +237,7 @@ export const MarketplaceTable: React.FC<MarketplaceTableProps> = ({
|
||||
</Th>
|
||||
))}
|
||||
{/* // Need to add an empty header for the drawer button */}
|
||||
<Th border="none" />
|
||||
<Th border="none" key="drawer" />
|
||||
</Tr>
|
||||
))}
|
||||
</Thead>
|
||||
|
||||
+4
-1
@@ -1,7 +1,7 @@
|
||||
import { SkeletonContainer } from "@/components/ui/skeleton";
|
||||
import { TrackedLinkTW } from "@/components/ui/tracked-link";
|
||||
import { useMemo } from "react";
|
||||
import { type NFT, ZERO_ADDRESS } from "thirdweb";
|
||||
import { type NFT, type ThirdwebClient, ZERO_ADDRESS } from "thirdweb";
|
||||
import { NFTMediaWithEmptyState } from "tw-components/nft-media";
|
||||
import type { ProjectMeta } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/types";
|
||||
import { buildContractPagePath } from "../_utils/contract-page-path";
|
||||
@@ -32,6 +32,7 @@ interface NFTCardsProps {
|
||||
isPending: boolean;
|
||||
allNfts?: boolean;
|
||||
projectMeta: ProjectMeta | undefined;
|
||||
client: ThirdwebClient;
|
||||
}
|
||||
|
||||
export const NFTCards: React.FC<NFTCardsProps> = ({
|
||||
@@ -40,6 +41,7 @@ export const NFTCards: React.FC<NFTCardsProps> = ({
|
||||
isPending,
|
||||
allNfts,
|
||||
projectMeta,
|
||||
client,
|
||||
}) => {
|
||||
const dummyData = useMemo(() => {
|
||||
return Array.from({
|
||||
@@ -73,6 +75,7 @@ export const NFTCards: React.FC<NFTCardsProps> = ({
|
||||
requireInteraction
|
||||
width="100%"
|
||||
height="100%"
|
||||
client={client}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
|
||||
+2
@@ -528,6 +528,7 @@ export const ClaimConditionsForm: React.FC<ClaimConditionsFormProps> = ({
|
||||
form.setValue(`phases.${index}.snapshot`, snapshot)
|
||||
}
|
||||
isDisabled={!canEditForm}
|
||||
client={contract.client}
|
||||
/>
|
||||
|
||||
<ClaimsConditionFormContext.Provider
|
||||
@@ -658,6 +659,7 @@ export const ClaimConditionsForm: React.FC<ClaimConditionsFormProps> = ({
|
||||
hasRemovedPhases ||
|
||||
!isMultiPhase ? (
|
||||
<TransactionButton
|
||||
client={contract.client}
|
||||
isLoggedIn={isLoggedIn}
|
||||
txChainID={contract.chain.id}
|
||||
transactionCount={1}
|
||||
|
||||
+1
@@ -94,6 +94,7 @@ export const ResetClaimEligibility: React.FC<ResetClaimEligibilityProps> = ({
|
||||
return (
|
||||
<AdminOnly contract={contract} fallback={<div className="pb-5" />}>
|
||||
<TransactionButton
|
||||
client={contract.client}
|
||||
isLoggedIn={isLoggedIn}
|
||||
transactionCount={1}
|
||||
type="button"
|
||||
|
||||
+8
-2
@@ -14,7 +14,7 @@ import { useCsvUpload } from "hooks/useCsvUpload";
|
||||
import { CircleAlertIcon, DownloadIcon, UploadIcon } from "lucide-react";
|
||||
import { useRef } from "react";
|
||||
import type { Column } from "react-table";
|
||||
import { ZERO_ADDRESS } from "thirdweb";
|
||||
import { type ThirdwebClient, ZERO_ADDRESS } from "thirdweb";
|
||||
import { CsvDataTable } from "../csv-data-table";
|
||||
|
||||
interface SnapshotAddressInput {
|
||||
@@ -30,6 +30,7 @@ interface SnapshotUploadProps {
|
||||
isDisabled: boolean;
|
||||
value?: SnapshotAddressInput[] | undefined;
|
||||
onClose: () => void;
|
||||
client: ThirdwebClient;
|
||||
}
|
||||
|
||||
const csvParser = (items: SnapshotAddressInput[]): SnapshotAddressInput[] => {
|
||||
@@ -49,6 +50,7 @@ const SnapshotViewerSheetContent: React.FC<SnapshotUploadProps> = ({
|
||||
isDisabled,
|
||||
value,
|
||||
onClose,
|
||||
client,
|
||||
}) => {
|
||||
const {
|
||||
normalizeQuery,
|
||||
@@ -59,7 +61,11 @@ const SnapshotViewerSheetContent: React.FC<SnapshotUploadProps> = ({
|
||||
noCsv,
|
||||
reset,
|
||||
removeInvalid,
|
||||
} = useCsvUpload<SnapshotAddressInput>({ csvParser, defaultRawData: value });
|
||||
} = useCsvUpload<SnapshotAddressInput>({
|
||||
csvParser,
|
||||
defaultRawData: value,
|
||||
client,
|
||||
});
|
||||
|
||||
const paginationPortalRef = useRef<HTMLDivElement>(null);
|
||||
const normalizeData = normalizeQuery.data;
|
||||
|
||||
+3
@@ -6,9 +6,11 @@ import { ConfigureNetworks } from "components/configure-networks/ConfigureNetwor
|
||||
import { CheckIcon, CircleAlertIcon, RotateCcwIcon } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
import { addChainOverrides } from "stores/chainStores";
|
||||
import type { ThirdwebClient } from "thirdweb";
|
||||
|
||||
export function ConfigureCustomChain(props: {
|
||||
chainSlug: string;
|
||||
client: ThirdwebClient;
|
||||
}) {
|
||||
const { chainSlug } = props;
|
||||
const isSlugNumber = Number.isInteger(Number(chainSlug));
|
||||
@@ -61,6 +63,7 @@ export function ConfigureCustomChain(props: {
|
||||
}
|
||||
}}
|
||||
editChain={undefined}
|
||||
client={props.client}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
-1
@@ -43,7 +43,6 @@ export async function getContractMetadataHeaderData(
|
||||
fetchDashboardContractMetadata(contract),
|
||||
fetchPublishedContractsFromDeploy({
|
||||
contract,
|
||||
client: contract.client,
|
||||
}),
|
||||
]);
|
||||
|
||||
|
||||
+14
-16
@@ -82,21 +82,19 @@ export const MetadataHeader: React.FC<MetadataHeaderProps> = ({
|
||||
</h1>
|
||||
)}
|
||||
|
||||
{chain && (
|
||||
<Link
|
||||
href={`/${chain.slug}`}
|
||||
className="flex w-fit shrink-0 items-center gap-2 rounded-3xl border border-border bg-card px-2.5 py-1.5 hover:bg-accent"
|
||||
>
|
||||
<ChainIconClient
|
||||
src={chain.icon?.url}
|
||||
client={client}
|
||||
className="size-4"
|
||||
/>
|
||||
{cleanedChainName && (
|
||||
<span className="text-xs">{cleanedChainName}</span>
|
||||
)}
|
||||
</Link>
|
||||
)}
|
||||
<Link
|
||||
href={`/${chain.slug}`}
|
||||
className="flex w-fit shrink-0 items-center gap-2 rounded-3xl border border-border bg-card px-2.5 py-1.5 hover:bg-accent"
|
||||
>
|
||||
<ChainIconClient
|
||||
src={chain.icon?.url}
|
||||
client={client}
|
||||
className="size-4"
|
||||
/>
|
||||
{cleanedChainName && (
|
||||
<span className="text-xs">{cleanedChainName}</span>
|
||||
)}
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -115,7 +113,7 @@ export const MetadataHeader: React.FC<MetadataHeaderProps> = ({
|
||||
<CopyAddressButton
|
||||
address={address}
|
||||
copyIconPosition="left"
|
||||
className="bg-card text-xs"
|
||||
className="bg-card px-2.5 py-1.5 text-xs"
|
||||
variant="outline"
|
||||
/>
|
||||
|
||||
|
||||
+11
-1
@@ -81,7 +81,17 @@ export const PrimaryDashboardButton: React.FC<AddToDashboardCardProps> = ({
|
||||
|
||||
// if user is on a project page
|
||||
if (projectMeta) {
|
||||
return null;
|
||||
return (
|
||||
<Button variant="default" asChild>
|
||||
<Link
|
||||
href={`/${contractInfo.chainSlug}/${contractAddress}`}
|
||||
target="_blank"
|
||||
className="gap-2"
|
||||
>
|
||||
View Asset Page <ExternalLinkIcon className="size-3.5" />
|
||||
</Link>
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
import { resolveFunctionSelectors } from "lib/selectors";
|
||||
import type { ThirdwebContract } from "thirdweb";
|
||||
import { isERC20 } from "thirdweb/extensions/erc20";
|
||||
|
||||
export type NewPublicPageType = "erc20";
|
||||
|
||||
export async function shouldRenderNewPublicPage(
|
||||
contract: ThirdwebContract,
|
||||
): Promise<false | { type: NewPublicPageType }> {
|
||||
try {
|
||||
const functionSelectors = await resolveFunctionSelectors(contract).catch(
|
||||
() => undefined,
|
||||
);
|
||||
|
||||
if (!functionSelectors) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const isERC20Contract = isERC20(functionSelectors);
|
||||
|
||||
if (isERC20Contract) {
|
||||
return {
|
||||
type: "erc20",
|
||||
};
|
||||
}
|
||||
|
||||
return false;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+8
-1
@@ -3,6 +3,7 @@ import { Badge } from "@/components/ui/badge";
|
||||
import { Flex, SimpleGrid, useBreakpointValue } from "@chakra-ui/react";
|
||||
import { formatDistance } from "date-fns/formatDistance";
|
||||
import { useAllChainsData } from "hooks/chains/allChains";
|
||||
import type { ThirdwebClient } from "thirdweb";
|
||||
import { useActiveAccount } from "thirdweb/react";
|
||||
import { Card, Heading, Text } from "tw-components";
|
||||
|
||||
@@ -16,11 +17,13 @@ export type AccountSignerType = {
|
||||
interface AccountSignerProps {
|
||||
item: AccountSignerType;
|
||||
contractChainId: number;
|
||||
client: ThirdwebClient;
|
||||
}
|
||||
|
||||
export const AccountSigner: React.FC<AccountSignerProps> = ({
|
||||
item,
|
||||
contractChainId,
|
||||
client,
|
||||
}) => {
|
||||
const address = useActiveAccount()?.address;
|
||||
const { idToChain } = useAllChainsData();
|
||||
@@ -43,7 +46,11 @@ export const AccountSigner: React.FC<AccountSignerProps> = ({
|
||||
flexDir={{ base: "column", lg: "row" }}
|
||||
>
|
||||
<Heading size="label.lg">
|
||||
<WalletAddress shortenAddress={isMobile} address={signer} />
|
||||
<WalletAddress
|
||||
shortenAddress={isMobile}
|
||||
address={signer}
|
||||
client={client}
|
||||
/>
|
||||
</Heading>
|
||||
<div className="flex flex-row gap-2">
|
||||
{isAdmin ? <Badge>Admin Key</Badge> : <Badge>Scoped key</Badge>}
|
||||
|
||||
+1
@@ -40,6 +40,7 @@ export const AccountSigners: React.FC<AccountSignersProps> = ({ contract }) => {
|
||||
<AccountSigner
|
||||
key={item.signer}
|
||||
item={item}
|
||||
client={contract.client}
|
||||
contractChainId={contract.chain.id}
|
||||
/>
|
||||
))}
|
||||
|
||||
+1
@@ -41,6 +41,7 @@ export const AccountPage: React.FC<AccountPageProps> = ({
|
||||
address={contract.address}
|
||||
symbol={symbol}
|
||||
chain={chainMetadata}
|
||||
client={contract.client}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
+4
-3
@@ -1,12 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { useThirdwebClient } from "@/constants/thirdweb.client";
|
||||
import { Input } from "@chakra-ui/react";
|
||||
import { TransactionButton } from "components/buttons/TransactionButton";
|
||||
import { useV5DashboardChain } from "lib/v5-adapter";
|
||||
import { type ChangeEvent, useState } from "react";
|
||||
import type { StoredChain } from "stores/chainStores";
|
||||
import { prepareTransaction, toWei } from "thirdweb";
|
||||
import { type ThirdwebClient, prepareTransaction, toWei } from "thirdweb";
|
||||
import { useSendAndConfirmTransaction } from "thirdweb/react";
|
||||
import { Card } from "tw-components";
|
||||
|
||||
@@ -15,6 +14,7 @@ interface DepositNativeProps {
|
||||
symbol: string;
|
||||
chain: StoredChain;
|
||||
isLoggedIn: boolean;
|
||||
client: ThirdwebClient;
|
||||
}
|
||||
|
||||
export const DepositNative: React.FC<DepositNativeProps> = ({
|
||||
@@ -22,8 +22,8 @@ export const DepositNative: React.FC<DepositNativeProps> = ({
|
||||
symbol,
|
||||
chain,
|
||||
isLoggedIn,
|
||||
client,
|
||||
}) => {
|
||||
const client = useThirdwebClient();
|
||||
const { mutate: transfer, isPending } = useSendAndConfirmTransaction();
|
||||
const [amount, setAmount] = useState("");
|
||||
const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
|
||||
@@ -48,6 +48,7 @@ export const DepositNative: React.FC<DepositNativeProps> = ({
|
||||
value={amount}
|
||||
/>
|
||||
<TransactionButton
|
||||
client={client}
|
||||
isLoggedIn={isLoggedIn}
|
||||
txChainID={v5Chain.id}
|
||||
transactionCount={1}
|
||||
|
||||
+1
@@ -27,6 +27,7 @@ export const NftsOwned: React.FC<NftsOwnedProps> = ({
|
||||
|
||||
return nfts.length !== 0 ? (
|
||||
<NFTCards
|
||||
client={contract.client}
|
||||
projectMeta={projectMeta}
|
||||
nfts={nfts.map((nft) => ({
|
||||
id: BigInt(nft.id),
|
||||
|
||||
+1
@@ -61,6 +61,7 @@ export const CreateAccountButton: React.FC<CreateAccountButtonProps> = ({
|
||||
|
||||
return (
|
||||
<TransactionButton
|
||||
client={contract.client}
|
||||
isLoggedIn={isLoggedIn}
|
||||
txChainID={contract.chain.id}
|
||||
onClick={() => {
|
||||
|
||||
+13
@@ -5,6 +5,7 @@ import type { ProjectMeta } from "../../../../../team/[team_slug]/[project_slug]
|
||||
import { redirectToContractLandingPage } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/utils";
|
||||
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
|
||||
import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
|
||||
import { shouldRenderNewPublicPage } from "../_utils/newPublicPage";
|
||||
import { ContractAnalyticsPage } from "./ContractAnalyticsPage";
|
||||
|
||||
export async function SharedAnalyticsPage(props: {
|
||||
@@ -22,6 +23,18 @@ export async function SharedAnalyticsPage(props: {
|
||||
notFound();
|
||||
}
|
||||
|
||||
// new public page can't show /analytics page
|
||||
if (!props.projectMeta) {
|
||||
const shouldHide = await shouldRenderNewPublicPage(info.serverContract);
|
||||
if (shouldHide) {
|
||||
redirectToContractLandingPage({
|
||||
contractAddress: props.contractAddress,
|
||||
chainIdOrSlug: props.chainIdOrSlug,
|
||||
projectMeta: props.projectMeta,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const [
|
||||
{ eventSelectorToName, writeFnSelectorToName },
|
||||
{ isInsightSupported },
|
||||
|
||||
+13
@@ -4,6 +4,7 @@ import { redirectToContractLandingPage } from "../../../../../team/[team_slug]/[
|
||||
import { ClaimConditions } from "../_components/claim-conditions/claim-conditions";
|
||||
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
|
||||
import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
|
||||
import { shouldRenderNewPublicPage } from "../_utils/newPublicPage";
|
||||
import { ClaimConditionsClient } from "./ClaimConditions.client";
|
||||
|
||||
export async function SharedClaimConditionsPage(props: {
|
||||
@@ -22,6 +23,18 @@ export async function SharedClaimConditionsPage(props: {
|
||||
notFound();
|
||||
}
|
||||
|
||||
// new public page can't show /claim-conditions page
|
||||
if (!props.projectMeta) {
|
||||
const shouldHide = await shouldRenderNewPublicPage(info.serverContract);
|
||||
if (shouldHide) {
|
||||
redirectToContractLandingPage({
|
||||
contractAddress: props.contractAddress,
|
||||
chainIdOrSlug: props.chainIdOrSlug,
|
||||
projectMeta: props.projectMeta,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const { clientContract, serverContract, isLocalhostChain } = info;
|
||||
|
||||
if (isLocalhostChain) {
|
||||
|
||||
+14
@@ -1,7 +1,9 @@
|
||||
import { notFound } from "next/navigation";
|
||||
import { resolveContractAbi } from "thirdweb/contract";
|
||||
import type { ProjectMeta } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/types";
|
||||
import { redirectToContractLandingPage } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/utils";
|
||||
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
|
||||
import { shouldRenderNewPublicPage } from "../_utils/newPublicPage";
|
||||
import { ContractCodePage } from "./contract-code-page";
|
||||
import { ContractCodePageClient } from "./contract-code-page.client";
|
||||
|
||||
@@ -20,6 +22,18 @@ export async function SharedCodePage(props: {
|
||||
notFound();
|
||||
}
|
||||
|
||||
// new public page can't show /code page
|
||||
if (!props.projectMeta) {
|
||||
const shouldHide = await shouldRenderNewPublicPage(info.serverContract);
|
||||
if (shouldHide) {
|
||||
redirectToContractLandingPage({
|
||||
contractAddress: props.contractAddress,
|
||||
chainIdOrSlug: props.chainIdOrSlug,
|
||||
projectMeta: props.projectMeta,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const { clientContract, serverContract, chainMetadata, isLocalhostChain } =
|
||||
info;
|
||||
|
||||
|
||||
+14
-2
@@ -20,8 +20,10 @@ import { eth_getCode, getRpcClient } from "thirdweb/rpc";
|
||||
import type { TransactionReceipt } from "thirdweb/transaction";
|
||||
import { type AbiFunction, decodeFunctionData } from "thirdweb/utils";
|
||||
import type { ProjectMeta } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/types";
|
||||
import { redirectToContractLandingPage } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/utils";
|
||||
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
|
||||
import { getContractPageMetadata } from "../_utils/getContractPageMetadata";
|
||||
import { shouldRenderNewPublicPage } from "../_utils/newPublicPage";
|
||||
import { DataTable } from "./data-table";
|
||||
import { NoCrossChainPrompt } from "./no-crosschain-prompt";
|
||||
|
||||
@@ -48,6 +50,18 @@ export async function SharedCrossChainPage(props: {
|
||||
notFound();
|
||||
}
|
||||
|
||||
// new public page can't show /cross-chain page
|
||||
if (!props.projectMeta) {
|
||||
const shouldHide = await shouldRenderNewPublicPage(info.serverContract);
|
||||
if (shouldHide) {
|
||||
redirectToContractLandingPage({
|
||||
contractAddress: props.contractAddress,
|
||||
chainIdOrSlug: props.chainIdOrSlug,
|
||||
projectMeta: props.projectMeta,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const { clientContract, serverContract } = info;
|
||||
|
||||
const isModularCore = (await getContractPageMetadata(serverContract))
|
||||
@@ -169,7 +183,6 @@ export async function SharedCrossChainPage(props: {
|
||||
coreMetadata = (
|
||||
await fetchPublishedContractsFromDeploy({
|
||||
contract: serverContract,
|
||||
client: serverContract.client,
|
||||
})
|
||||
).at(-1) as FetchDeployMetadataResult;
|
||||
} catch {}
|
||||
@@ -242,7 +255,6 @@ export async function SharedCrossChainPage(props: {
|
||||
client: serverContract.client,
|
||||
address: m,
|
||||
}),
|
||||
client: serverContract.client,
|
||||
})
|
||||
).at(-1),
|
||||
),
|
||||
|
||||
+14
@@ -1,6 +1,8 @@
|
||||
import { notFound } from "next/navigation";
|
||||
import type { ProjectMeta } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/types";
|
||||
import { redirectToContractLandingPage } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/utils";
|
||||
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
|
||||
import { shouldRenderNewPublicPage } from "../_utils/newPublicPage";
|
||||
import { EventsFeed } from "./events-feed";
|
||||
|
||||
export async function SharedEventsPage(props: {
|
||||
@@ -18,6 +20,18 @@ export async function SharedEventsPage(props: {
|
||||
notFound();
|
||||
}
|
||||
|
||||
// new public page can't show /events page
|
||||
if (!props.projectMeta) {
|
||||
const shouldHide = await shouldRenderNewPublicPage(info.serverContract);
|
||||
if (shouldHide) {
|
||||
redirectToContractLandingPage({
|
||||
contractAddress: props.contractAddress,
|
||||
chainIdOrSlug: props.chainIdOrSlug,
|
||||
projectMeta: props.projectMeta,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<EventsFeed
|
||||
contract={info.clientContract}
|
||||
|
||||
+14
@@ -1,7 +1,9 @@
|
||||
import { notFound } from "next/navigation";
|
||||
import { resolveContractAbi } from "thirdweb/contract";
|
||||
import type { ProjectMeta } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/types";
|
||||
import { redirectToContractLandingPage } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/utils";
|
||||
import { getContractPageParamsInfo } from "../_utils/getContractFromParams";
|
||||
import { shouldRenderNewPublicPage } from "../_utils/newPublicPage";
|
||||
import { ContractExplorerPage } from "./ContractExplorerPage";
|
||||
import { ContractExplorerPageClient } from "./ContractExplorerPage.client";
|
||||
|
||||
@@ -21,6 +23,18 @@ export async function SharedExplorerPage(props: {
|
||||
notFound();
|
||||
}
|
||||
|
||||
// new public page can't show /explorer page
|
||||
if (!props.projectMeta) {
|
||||
const shouldHide = await shouldRenderNewPublicPage(info.serverContract);
|
||||
if (shouldHide) {
|
||||
redirectToContractLandingPage({
|
||||
contractAddress: props.contractAddress,
|
||||
chainIdOrSlug: props.chainIdOrSlug,
|
||||
projectMeta: props.projectMeta,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const { clientContract, serverContract, chainMetadata, isLocalhostChain } =
|
||||
info;
|
||||
|
||||
|
||||
+3
-1
@@ -1,4 +1,5 @@
|
||||
import type { Metadata } from "next";
|
||||
import { getAuthToken } from "../../../../api/lib/getAuthToken";
|
||||
import {
|
||||
SharedContractLayout,
|
||||
generateContractLayoutMetadata,
|
||||
@@ -11,12 +12,13 @@ export default async function Layout(props: {
|
||||
}>;
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const params = await props.params;
|
||||
const [params, authToken] = await Promise.all([props.params, getAuthToken()]);
|
||||
return (
|
||||
<SharedContractLayout
|
||||
contractAddress={params.contractAddress}
|
||||
chainIdOrSlug={params.chain_id}
|
||||
projectMeta={undefined}
|
||||
authToken={authToken}
|
||||
>
|
||||
{props.children}
|
||||
</SharedContractLayout>
|
||||
|
||||
+6
-1
@@ -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";
|
||||
@@ -94,6 +94,7 @@ function BatchMetadataModule(props: ModuleInstanceProps) {
|
||||
uploadMetadata={uploadMetadata}
|
||||
isOwnerAccount={!!ownerAccount}
|
||||
contractChainId={contract.chain.id}
|
||||
client={contract.client}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -104,6 +105,7 @@ export function BatchMetadataModuleUI(
|
||||
uploadMetadata: (values: UploadMetadataFormValues) => Promise<void>;
|
||||
contractChainId: number;
|
||||
isLoggedIn: boolean;
|
||||
client: ThirdwebClient;
|
||||
},
|
||||
) {
|
||||
return (
|
||||
@@ -121,6 +123,7 @@ export function BatchMetadataModuleUI(
|
||||
isLoggedIn={props.isLoggedIn}
|
||||
uploadMetadata={props.uploadMetadata}
|
||||
contractChainId={props.contractChainId}
|
||||
client={props.client}
|
||||
/>
|
||||
)}
|
||||
{!props.isOwnerAccount && (
|
||||
@@ -163,6 +166,7 @@ function UploadMetadataNFTSection(props: {
|
||||
uploadMetadata: (values: UploadMetadataFormValues) => Promise<void>;
|
||||
contractChainId: number;
|
||||
isLoggedIn: boolean;
|
||||
client: ThirdwebClient;
|
||||
}) {
|
||||
const form = useForm<UploadMetadataFormValues>({
|
||||
resolver: zodResolver(uploadMetadataFormSchema),
|
||||
@@ -261,6 +265,7 @@ function UploadMetadataNFTSection(props: {
|
||||
|
||||
<div className="flex justify-end">
|
||||
<TransactionButton
|
||||
client={props.client}
|
||||
isLoggedIn={props.isLoggedIn}
|
||||
size="sm"
|
||||
className="min-w-24"
|
||||
|
||||
+12
@@ -41,6 +41,7 @@ import { useFieldArray, useForm } from "react-hook-form";
|
||||
import {
|
||||
NATIVE_TOKEN_ADDRESS,
|
||||
type PreparedTransaction,
|
||||
type ThirdwebClient,
|
||||
ZERO_ADDRESS,
|
||||
getContract,
|
||||
sendAndConfirmTransaction,
|
||||
@@ -271,6 +272,7 @@ function ClaimableModule(props: ModuleInstanceProps) {
|
||||
return (
|
||||
<ClaimableModuleUI
|
||||
{...props}
|
||||
client={props.contract.client}
|
||||
primarySaleRecipientSection={{
|
||||
data: primarySaleRecipientQuery.data
|
||||
? { primarySaleRecipient: primarySaleRecipientQuery.data }
|
||||
@@ -342,6 +344,7 @@ export function ClaimableModuleUI(
|
||||
isLoading: boolean;
|
||||
};
|
||||
isLoggedIn: boolean;
|
||||
client: ThirdwebClient;
|
||||
},
|
||||
) {
|
||||
return (
|
||||
@@ -357,6 +360,7 @@ export function ClaimableModuleUI(
|
||||
</AccordionTrigger>
|
||||
<AccordionContent className="px-1">
|
||||
<MintNFTSection
|
||||
client={props.client}
|
||||
mint={props.mintSection.mint}
|
||||
name={props.name}
|
||||
contractChainId={props.contractChainId}
|
||||
@@ -389,6 +393,7 @@ export function ClaimableModuleUI(
|
||||
{props.name !== "ClaimableERC1155" || props.isValidTokenId ? (
|
||||
props.claimConditionSection.data ? (
|
||||
<ClaimConditionSection
|
||||
client={props.client}
|
||||
isLoggedIn={props.isLoggedIn}
|
||||
isOwnerAccount={props.isOwnerAccount}
|
||||
claimCondition={
|
||||
@@ -423,6 +428,7 @@ export function ClaimableModuleUI(
|
||||
<AccordionContent className="px-1">
|
||||
{props.primarySaleRecipientSection.data ? (
|
||||
<PrimarySaleRecipientSection
|
||||
client={props.client}
|
||||
isLoggedIn={props.isLoggedIn}
|
||||
isOwnerAccount={props.isOwnerAccount}
|
||||
primarySaleRecipient={
|
||||
@@ -489,6 +495,7 @@ function ClaimConditionSection(props: {
|
||||
tokenId: string;
|
||||
noClaimConditionSet: boolean;
|
||||
isLoggedIn: boolean;
|
||||
client: ThirdwebClient;
|
||||
}) {
|
||||
const { idToChain } = useAllChainsData();
|
||||
const chain = idToChain.get(props.chainId);
|
||||
@@ -740,6 +747,7 @@ function ClaimConditionSection(props: {
|
||||
|
||||
<div className="flex justify-end">
|
||||
<TransactionButton
|
||||
client={props.client}
|
||||
isLoggedIn={props.isLoggedIn}
|
||||
size="sm"
|
||||
className="min-w-24"
|
||||
@@ -774,6 +782,7 @@ function PrimarySaleRecipientSection(props: {
|
||||
isOwnerAccount: boolean;
|
||||
contractChainId: number;
|
||||
isLoggedIn: boolean;
|
||||
client: ThirdwebClient;
|
||||
}) {
|
||||
const form = useForm<PrimarySaleRecipientFormValues>({
|
||||
resolver: zodResolver(primarySaleRecipientFormSchema),
|
||||
@@ -822,6 +831,7 @@ function PrimarySaleRecipientSection(props: {
|
||||
|
||||
<div className="flex justify-end">
|
||||
<TransactionButton
|
||||
client={props.client}
|
||||
isLoggedIn={props.isLoggedIn}
|
||||
size="sm"
|
||||
className="min-w-24 gap-2"
|
||||
@@ -858,6 +868,7 @@ function MintNFTSection(props: {
|
||||
name: string;
|
||||
contractChainId: number;
|
||||
isLoggedIn: boolean;
|
||||
client: ThirdwebClient;
|
||||
}) {
|
||||
const form = useForm<MintFormValues>({
|
||||
resolver: zodResolver(mintFormSchema),
|
||||
@@ -939,6 +950,7 @@ function MintNFTSection(props: {
|
||||
|
||||
<div className="flex justify-end">
|
||||
<TransactionButton
|
||||
client={props.client}
|
||||
size="sm"
|
||||
className="min-w-24 gap-2"
|
||||
disabled={mintMutation.isPending}
|
||||
|
||||
+13
-1
@@ -27,7 +27,11 @@ import { useTxNotifications } from "hooks/useTxNotifications";
|
||||
import { CircleAlertIcon } from "lucide-react";
|
||||
import { useCallback } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { type PreparedTransaction, sendAndConfirmTransaction } from "thirdweb";
|
||||
import {
|
||||
type PreparedTransaction,
|
||||
type ThirdwebClient,
|
||||
sendAndConfirmTransaction,
|
||||
} from "thirdweb";
|
||||
import {
|
||||
MintableERC20,
|
||||
MintableERC721,
|
||||
@@ -177,6 +181,7 @@ function MintableModule(props: ModuleInstanceProps) {
|
||||
name={props.contractInfo.name}
|
||||
isBatchMetadataInstalled={isBatchMetadataInstalled}
|
||||
contractChainId={contract.chain.id}
|
||||
client={contract.client}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -192,6 +197,7 @@ export function MintableModuleUI(
|
||||
isBatchMetadataInstalled: boolean;
|
||||
contractChainId: number;
|
||||
isLoggedIn: boolean;
|
||||
client: ThirdwebClient;
|
||||
},
|
||||
) {
|
||||
return (
|
||||
@@ -215,6 +221,7 @@ export function MintableModuleUI(
|
||||
name={props.name}
|
||||
isBatchMetadataInstalled={props.isBatchMetadataInstalled}
|
||||
contractChainId={props.contractChainId}
|
||||
client={props.client}
|
||||
/>
|
||||
)}
|
||||
{!props.isOwnerAccount && (
|
||||
@@ -242,6 +249,7 @@ export function MintableModuleUI(
|
||||
update={props.updatePrimaryRecipient}
|
||||
contractChainId={props.contractChainId}
|
||||
isLoggedIn={props.isLoggedIn}
|
||||
client={props.client}
|
||||
/>
|
||||
</AccordionContent>
|
||||
</AccordionItem>
|
||||
@@ -262,6 +270,7 @@ function PrimarySalesSection(props: {
|
||||
isOwnerAccount: boolean;
|
||||
contractChainId: number;
|
||||
isLoggedIn: boolean;
|
||||
client: ThirdwebClient;
|
||||
}) {
|
||||
const form = useForm<UpdateFormValues>({
|
||||
resolver: zodResolver(primarySaleRecipientFormSchema),
|
||||
@@ -311,6 +320,7 @@ function PrimarySalesSection(props: {
|
||||
|
||||
<div className="mt-4 flex justify-end">
|
||||
<TransactionButton
|
||||
client={props.client}
|
||||
isLoggedIn={props.isLoggedIn}
|
||||
size="sm"
|
||||
className="min-w-24"
|
||||
@@ -340,6 +350,7 @@ function MintNFTSection(props: {
|
||||
isBatchMetadataInstalled: boolean;
|
||||
contractChainId: number;
|
||||
isLoggedIn: boolean;
|
||||
client: ThirdwebClient;
|
||||
}) {
|
||||
const form = useForm<MintFormValues>({
|
||||
resolver: zodResolver(mintFormSchema),
|
||||
@@ -523,6 +534,7 @@ function MintNFTSection(props: {
|
||||
|
||||
<div className="flex justify-end">
|
||||
<TransactionButton
|
||||
client={props.client}
|
||||
isLoggedIn={props.isLoggedIn}
|
||||
size="sm"
|
||||
className="min-w-24"
|
||||
|
||||
+9
-7
@@ -1,7 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { Spinner } from "@/components/ui/Spinner/Spinner";
|
||||
import { useThirdwebClient } from "@/constants/thirdweb.client";
|
||||
import { FormControl, Input, Select, Skeleton, Spacer } from "@chakra-ui/react";
|
||||
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||
import { TransactionButton } from "components/buttons/TransactionButton";
|
||||
@@ -60,7 +59,6 @@ type InstallModuleFormProps = {
|
||||
export type InstallModuleForm = UseFormReturn<FormData>;
|
||||
|
||||
export const InstallModuleForm = (props: InstallModuleFormProps) => {
|
||||
const client = useThirdwebClient();
|
||||
const form = useForm<FormData>({
|
||||
defaultValues: {
|
||||
publisherAddress: "0xdd99b75f095d0c4d5112aCe938e4e6ed962fb024", // thirdweb publisher address
|
||||
@@ -71,9 +69,10 @@ export const InstallModuleForm = (props: InstallModuleFormProps) => {
|
||||
const { contract, account } = props;
|
||||
const { errors } = formState;
|
||||
|
||||
const { data, isPending, isFetching } = usePublishedContractsQuery(
|
||||
watch("publisherAddress"),
|
||||
);
|
||||
const { data, isPending, isFetching } = usePublishedContractsQuery({
|
||||
client: contract.client,
|
||||
address: watch("publisherAddress"),
|
||||
});
|
||||
|
||||
// filter out all the contracts that AREN'T modules
|
||||
const modulesOnly = useMemo(() => {
|
||||
@@ -90,6 +89,7 @@ export const InstallModuleForm = (props: InstallModuleFormProps) => {
|
||||
const allVersions = useAllVersions(
|
||||
watch("publisherAddress"),
|
||||
watch("moduleContract"),
|
||||
contract.client,
|
||||
);
|
||||
|
||||
const installMutation = useMutation({
|
||||
@@ -182,7 +182,7 @@ export const InstallModuleForm = (props: InstallModuleFormProps) => {
|
||||
moduleAddress.map(async (address) => {
|
||||
const result = await resolveImplementation(
|
||||
getContract({
|
||||
client,
|
||||
client: contract.client,
|
||||
address,
|
||||
chain: contract.chain,
|
||||
}),
|
||||
@@ -231,7 +231,7 @@ export const InstallModuleForm = (props: InstallModuleFormProps) => {
|
||||
moduleInfo: {
|
||||
bytecodeUri: selectedModule.metadata.bytecodeUri,
|
||||
},
|
||||
client,
|
||||
client: contract.client,
|
||||
});
|
||||
},
|
||||
retry: false,
|
||||
@@ -255,6 +255,7 @@ export const InstallModuleForm = (props: InstallModuleFormProps) => {
|
||||
const moduleInstallParams = useModuleInstallParams({
|
||||
module: selectedModuleMeta,
|
||||
isQueryEnabled: !!selectedModule && !!isModuleCompatibleQuery.data,
|
||||
client: contract.client,
|
||||
});
|
||||
|
||||
return (
|
||||
@@ -387,6 +388,7 @@ export const InstallModuleForm = (props: InstallModuleFormProps) => {
|
||||
{/* Submit */}
|
||||
<div className="flex justify-end">
|
||||
<TransactionButton
|
||||
client={contract.client}
|
||||
isLoggedIn={props.isLoggedIn}
|
||||
txChainID={contract.chain.id}
|
||||
transactionCount={1}
|
||||
|
||||
+5
-1
@@ -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 { OpenEditionMetadataERC721 } from "thirdweb/modules";
|
||||
import { z } from "zod";
|
||||
import { ModuleCardUI, type ModuleCardUIProps } from "./module-card";
|
||||
@@ -73,6 +73,7 @@ function OpenEditionMetadataModule(props: ModuleInstanceProps) {
|
||||
setSharedMetadata={setSharedMetadata}
|
||||
isOwnerAccount={!!props.ownerAccount}
|
||||
contractChainId={props.contract.chain.id}
|
||||
client={props.contract.client}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -99,6 +100,7 @@ export function OpenEditionMetadataModuleUI(
|
||||
setSharedMetadata={props.setSharedMetadata}
|
||||
contractChainId={props.contractChainId}
|
||||
isLoggedIn={props.isLoggedIn}
|
||||
client={props.client}
|
||||
/>
|
||||
)}
|
||||
{!props.isOwnerAccount && (
|
||||
@@ -121,6 +123,7 @@ function SetSharedMetadataSection(props: {
|
||||
setSharedMetadata: (values: SetSharedMetadataFormValues) => Promise<void>;
|
||||
contractChainId: number;
|
||||
isLoggedIn: boolean;
|
||||
client: ThirdwebClient;
|
||||
}) {
|
||||
const form = useForm<SetSharedMetadataFormValues>({
|
||||
resolver: zodResolver(setSharedMetadataFormSchema),
|
||||
@@ -212,6 +215,7 @@ function SetSharedMetadataSection(props: {
|
||||
<div className="flex justify-end">
|
||||
<TransactionButton
|
||||
size="sm"
|
||||
client={props.client}
|
||||
className="min-w-24"
|
||||
disabled={setSharedMetadataMutation.isPending}
|
||||
type="submit"
|
||||
|
||||
+11
-1
@@ -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 { RoyaltyERC721, RoyaltyERC1155 } from "thirdweb/modules";
|
||||
import { useReadContract } from "thirdweb/react";
|
||||
import { z } from "zod";
|
||||
@@ -150,6 +150,7 @@ function RoyaltyModule(props: ModuleInstanceProps) {
|
||||
setRoyaltyInfoForToken={setRoyaltyInfoForToken}
|
||||
isOwnerAccount={!!ownerAccount}
|
||||
contractChainId={props.contract.chain.id}
|
||||
client={props.contract.client}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -186,6 +187,7 @@ export function RoyaltyModuleUI(
|
||||
setRoyaltyInfoForToken={props.setRoyaltyInfoForToken}
|
||||
contractChainId={props.contractChainId}
|
||||
isLoggedIn={props.isLoggedIn}
|
||||
client={props.client}
|
||||
/>
|
||||
) : (
|
||||
<Alert variant="info">
|
||||
@@ -209,6 +211,7 @@ export function RoyaltyModuleUI(
|
||||
defaultRoyaltyInfo={props.defaultRoyaltyInfo}
|
||||
contractChainId={props.contractChainId}
|
||||
isLoggedIn={props.isLoggedIn}
|
||||
client={props.client}
|
||||
/>
|
||||
) : (
|
||||
<Alert variant="info">
|
||||
@@ -232,6 +235,7 @@ export function RoyaltyModuleUI(
|
||||
transferValidator={props.transferValidator}
|
||||
contractChainId={props.contractChainId}
|
||||
isLoggedIn={props.isLoggedIn}
|
||||
client={props.client}
|
||||
/>
|
||||
) : (
|
||||
<Alert variant="info">
|
||||
@@ -269,6 +273,7 @@ function RoyaltyInfoPerTokenSection(props: {
|
||||
setRoyaltyInfoForToken: (values: RoyaltyInfoFormValues) => Promise<void>;
|
||||
contractChainId: number;
|
||||
isLoggedIn: boolean;
|
||||
client: ThirdwebClient;
|
||||
}) {
|
||||
const form = useForm<RoyaltyInfoFormValues>({
|
||||
resolver: zodResolver(royaltyInfoFormSchema),
|
||||
@@ -348,6 +353,7 @@ function RoyaltyInfoPerTokenSection(props: {
|
||||
|
||||
<div className="mt-4 flex justify-end">
|
||||
<TransactionButton
|
||||
client={props.client}
|
||||
isLoggedIn={props.isLoggedIn}
|
||||
size="sm"
|
||||
className="min-w-24"
|
||||
@@ -383,6 +389,7 @@ function DefaultRoyaltyInfoSection(props: {
|
||||
update: (values: DefaultRoyaltyFormValues) => Promise<void>;
|
||||
contractChainId: number;
|
||||
isLoggedIn: boolean;
|
||||
client: ThirdwebClient;
|
||||
}) {
|
||||
const [defaultRoyaltyRecipient, defaultRoyaltyPercentage] =
|
||||
props.defaultRoyaltyInfo || [];
|
||||
@@ -452,6 +459,7 @@ function DefaultRoyaltyInfoSection(props: {
|
||||
|
||||
<div className="mt-4 flex justify-end">
|
||||
<TransactionButton
|
||||
client={props.client}
|
||||
size="sm"
|
||||
className="min-w-24"
|
||||
disabled={updateMutation.isPending}
|
||||
@@ -483,6 +491,7 @@ function TransferValidatorSection(props: {
|
||||
update: (values: TransferValidatorFormValues) => Promise<void>;
|
||||
contractChainId: number;
|
||||
isLoggedIn: boolean;
|
||||
client: ThirdwebClient;
|
||||
}) {
|
||||
const form = useForm<TransferValidatorFormValues>({
|
||||
resolver: zodResolver(transferValidatorFormSchema),
|
||||
@@ -530,6 +539,7 @@ function TransferValidatorSection(props: {
|
||||
|
||||
<div className="mt-4 flex justify-end">
|
||||
<TransactionButton
|
||||
client={props.client}
|
||||
isLoggedIn={props.isLoggedIn}
|
||||
size="sm"
|
||||
className="min-w-24 gap-2"
|
||||
|
||||
+2
@@ -123,6 +123,7 @@ function TransferableModule(props: ModuleInstanceProps) {
|
||||
update={update}
|
||||
isOwnerAccount={!!props.ownerAccount}
|
||||
contractChainId={props.contract.chain.id}
|
||||
client={props.contract.client}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -184,6 +185,7 @@ export function TransferableModuleUI(
|
||||
updateButton={() => {
|
||||
return (
|
||||
<TransactionButton
|
||||
client={props.client}
|
||||
size="sm"
|
||||
className="min-w-24 gap-2"
|
||||
type="submit"
|
||||
|
||||
+1
@@ -87,6 +87,7 @@ function Component() {
|
||||
contractInfo={contractInfo}
|
||||
moduleAddress="0x0000000000000000000000000000000000000000"
|
||||
uploadMetadata={uploadMetadataStub}
|
||||
client={storybookThirdwebClient}
|
||||
uninstallButton={{
|
||||
onClick: async () => removeMutation.mutateAsync(),
|
||||
isPending: removeMutation.isPending,
|
||||
|
||||
+1
@@ -147,6 +147,7 @@ function Component() {
|
||||
</div>
|
||||
|
||||
<ClaimableModuleUI
|
||||
client={storybookThirdwebClient}
|
||||
isLoggedIn={true}
|
||||
contractInfo={contractInfo}
|
||||
moduleAddress="0x0000000000000000000000000000000000000000"
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
import { useThirdwebClient } from "@/constants/thirdweb.client";
|
||||
import { FormControl } from "@chakra-ui/react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { SolidityInput } from "contract-ui/components/solidity-inputs";
|
||||
import type { ThirdwebClient } from "thirdweb";
|
||||
import invariant from "tiny-invariant";
|
||||
import { FormErrorMessage, FormLabel } from "tw-components";
|
||||
import type { InstallModuleForm } from "./ModuleForm";
|
||||
@@ -20,9 +20,9 @@ export type ModuleMeta = {
|
||||
export function useModuleInstallParams(props: {
|
||||
module?: ModuleMeta;
|
||||
isQueryEnabled: boolean;
|
||||
client: ThirdwebClient;
|
||||
}) {
|
||||
const client = useThirdwebClient();
|
||||
const { module, isQueryEnabled } = props;
|
||||
const { module, isQueryEnabled, client } = props;
|
||||
return useQuery({
|
||||
queryKey: ["useModuleInstallParams", module],
|
||||
queryFn: async () => {
|
||||
|
||||
+3
@@ -106,6 +106,7 @@ function Component() {
|
||||
|
||||
<BadgeContainer label="Empty Primary Sale Recipient">
|
||||
<MintableModuleUI
|
||||
client={storybookThirdwebClient}
|
||||
isLoggedIn={true}
|
||||
contractInfo={contractInfo}
|
||||
moduleAddress="0x0000000000000000000000000000000000000000"
|
||||
@@ -126,6 +127,7 @@ function Component() {
|
||||
|
||||
<BadgeContainer label="Filled Primary Sale Recipient">
|
||||
<MintableModuleUI
|
||||
client={storybookThirdwebClient}
|
||||
isLoggedIn={true}
|
||||
contractInfo={contractInfo}
|
||||
moduleAddress="0x0000000000000000000000000000000000000000"
|
||||
@@ -146,6 +148,7 @@ function Component() {
|
||||
|
||||
<BadgeContainer label="Pending">
|
||||
<MintableModuleUI
|
||||
client={storybookThirdwebClient}
|
||||
isLoggedIn={true}
|
||||
contractInfo={contractInfo}
|
||||
moduleAddress="0x0000000000000000000000000000000000000000"
|
||||
|
||||
+5
-2
@@ -2,7 +2,7 @@ import { Checkbox } from "@/components/ui/checkbox";
|
||||
import type { Meta, StoryObj } from "@storybook/react";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { useState } from "react";
|
||||
import { BadgeContainer } from "stories/utils";
|
||||
import { BadgeContainer, storybookThirdwebClient } from "stories/utils";
|
||||
import { ThirdwebProvider } from "thirdweb/react";
|
||||
import { ModuleCardUI } from "./module-card";
|
||||
|
||||
@@ -64,11 +64,12 @@ function Component() {
|
||||
<ModuleCardUI
|
||||
contractInfo={contractInfo}
|
||||
moduleAddress="0x0000000000000000000000000000000000000000"
|
||||
client={storybookThirdwebClient}
|
||||
isOwnerAccount={isOwner}
|
||||
uninstallButton={{
|
||||
onClick: () => removeMutation.mutateAsync(),
|
||||
isPending: removeMutation.isPending,
|
||||
}}
|
||||
isOwnerAccount={isOwner}
|
||||
/>
|
||||
</BadgeContainer>
|
||||
|
||||
@@ -76,6 +77,7 @@ function Component() {
|
||||
<ModuleCardUI
|
||||
contractInfo={contractInfo}
|
||||
moduleAddress="0x0000000000000000000000000000000000000000"
|
||||
client={storybookThirdwebClient}
|
||||
uninstallButton={{
|
||||
onClick: () => removeMutation.mutateAsync(),
|
||||
isPending: removeMutation.isPending,
|
||||
@@ -93,6 +95,7 @@ function Component() {
|
||||
<ModuleCardUI
|
||||
contractInfo={contractInfo}
|
||||
moduleAddress="0x0000000000000000000000000000000000000000"
|
||||
client={storybookThirdwebClient}
|
||||
uninstallButton={{
|
||||
onClick: () => removeMutation.mutateAsync(),
|
||||
isPending: removeMutation.isPending,
|
||||
|
||||
+7
-1
@@ -22,6 +22,7 @@ import { Suspense, useEffect, useState } from "react";
|
||||
import { ErrorBoundary, type FallbackProps } from "react-error-boundary";
|
||||
import { toast } from "sonner";
|
||||
import {
|
||||
type ThirdwebClient,
|
||||
type ThirdwebContract,
|
||||
getContract,
|
||||
sendTransaction,
|
||||
@@ -160,6 +161,7 @@ export function ModuleCard(props: ModuleCardProps) {
|
||||
</Button>
|
||||
|
||||
<TransactionButton
|
||||
client={contract.client}
|
||||
isLoggedIn={props.isLoggedIn}
|
||||
txChainID={contract.chain.id}
|
||||
transactionCount={1}
|
||||
@@ -180,6 +182,7 @@ export function ModuleCard(props: ModuleCardProps) {
|
||||
|
||||
export type ModuleCardUIProps = {
|
||||
children?: React.ReactNode;
|
||||
client: ThirdwebClient;
|
||||
contractInfo: {
|
||||
name: string;
|
||||
description?: string;
|
||||
@@ -249,7 +252,10 @@ export function ModuleCardUI(props: ModuleCardUIProps) {
|
||||
<p className="text-muted-foreground text-sm">
|
||||
Published By
|
||||
</p>
|
||||
<WalletAddress address={props.contractInfo.publisher} />
|
||||
<WalletAddress
|
||||
address={props.contractInfo.publisher}
|
||||
client={props.client}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
+8
-2
@@ -14,7 +14,7 @@ const OpenEditionMetadataModule = lazy(() => import("./OpenEditionMetadata"));
|
||||
|
||||
export type ModuleInstanceProps = Omit<
|
||||
ModuleCardUIProps,
|
||||
"children" | "updateButton" | "isOwnerAccount"
|
||||
"children" | "updateButton" | "isOwnerAccount" | "client"
|
||||
> & {
|
||||
contract: ThirdwebContract;
|
||||
ownerAccount: Account | undefined;
|
||||
@@ -52,5 +52,11 @@ export function ModuleInstance(props: ModuleInstanceProps) {
|
||||
return <OpenEditionMetadataModule {...props} />;
|
||||
}
|
||||
|
||||
return <ModuleCardUI {...props} isOwnerAccount={!!props.ownerAccount} />;
|
||||
return (
|
||||
<ModuleCardUI
|
||||
{...props}
|
||||
isOwnerAccount={!!props.ownerAccount}
|
||||
client={props.contract.client}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
+1
@@ -84,6 +84,7 @@ function Component() {
|
||||
isPending: removeMutation.isPending,
|
||||
}}
|
||||
isOwnerAccount={isOwner}
|
||||
client={storybookThirdwebClient}
|
||||
contractChainId={1}
|
||||
isLoggedIn={true}
|
||||
/>
|
||||
|
||||
+4
@@ -83,6 +83,7 @@ function Component() {
|
||||
|
||||
<BadgeContainer label="Empty Transfer Validator & Default Royalty Info">
|
||||
<RoyaltyModuleUI
|
||||
client={storybookThirdwebClient}
|
||||
contractInfo={contractInfo}
|
||||
moduleAddress="0x0000000000000000000000000000000000000000"
|
||||
isPending={false}
|
||||
@@ -115,11 +116,13 @@ function Component() {
|
||||
isOwnerAccount={isOwner}
|
||||
contractChainId={1}
|
||||
isLoggedIn={true}
|
||||
client={storybookThirdwebClient}
|
||||
/>
|
||||
</BadgeContainer>
|
||||
|
||||
<BadgeContainer label="Non-Empty Transfer Validator & Empty Default Royalty Info">
|
||||
<RoyaltyModuleUI
|
||||
client={storybookThirdwebClient}
|
||||
contractInfo={contractInfo}
|
||||
moduleAddress="0x0000000000000000000000000000000000000000"
|
||||
isPending={false}
|
||||
@@ -154,6 +157,7 @@ function Component() {
|
||||
isOwnerAccount={isOwner}
|
||||
contractChainId={1}
|
||||
isLoggedIn={true}
|
||||
client={storybookThirdwebClient}
|
||||
/>
|
||||
</BadgeContainer>
|
||||
</div>
|
||||
|
||||
+3
@@ -79,6 +79,7 @@ function Component() {
|
||||
<BadgeContainer label="Empty AllowList, Not Restricted">
|
||||
<TransferableModuleUI
|
||||
contractInfo={contractInfo}
|
||||
client={storybookThirdwebClient}
|
||||
moduleAddress="0x0000000000000000000000000000000000000000"
|
||||
isPending={false}
|
||||
isRestricted={false}
|
||||
@@ -97,6 +98,7 @@ function Component() {
|
||||
<BadgeContainer label="Empty AllowList, Restricted">
|
||||
<TransferableModuleUI
|
||||
contractInfo={contractInfo}
|
||||
client={storybookThirdwebClient}
|
||||
moduleAddress="0x0000000000000000000000000000000000000000"
|
||||
isPending={false}
|
||||
isRestricted={true}
|
||||
@@ -126,6 +128,7 @@ function Component() {
|
||||
}}
|
||||
isOwnerAccount={isOwner}
|
||||
contractChainId={1}
|
||||
client={storybookThirdwebClient}
|
||||
isLoggedIn={true}
|
||||
/>
|
||||
</BadgeContainer>
|
||||
|
||||
+2
@@ -135,6 +135,7 @@ const AirdropTab: React.FC<AirdropTabProps> = ({
|
||||
</SheetTitle>
|
||||
</SheetHeader>
|
||||
<AirdropUpload
|
||||
client={contract.client}
|
||||
onClose={() => setOpen(false)}
|
||||
setAirdrop={(value) =>
|
||||
setValue("addresses", value, { shouldDirty: true })
|
||||
@@ -162,6 +163,7 @@ const AirdropTab: React.FC<AirdropTabProps> = ({
|
||||
more, please do it in multiple transactions.
|
||||
</p>
|
||||
<TransactionButton
|
||||
client={contract.client}
|
||||
isLoggedIn={isLoggedIn}
|
||||
txChainID={contract.chain.id}
|
||||
transactionCount={1}
|
||||
|
||||
+1
@@ -130,6 +130,7 @@ const BurnTab: React.FC<BurnTabProps> = ({ contract, tokenId, isLoggedIn }) => {
|
||||
</Text>
|
||||
)}
|
||||
<TransactionButton
|
||||
client={contract.client}
|
||||
transactionCount={1}
|
||||
isPending={isPending}
|
||||
disabled={checking1155 || checking721 || isPending || !account}
|
||||
|
||||
+1
@@ -124,6 +124,7 @@ const ClaimTabERC1155: React.FC<ClaimTabProps> = ({
|
||||
</Flex>
|
||||
|
||||
<TransactionButton
|
||||
client={contract.client}
|
||||
isLoggedIn={isLoggedIn}
|
||||
txChainID={contract.chain.id}
|
||||
transactionCount={1}
|
||||
|
||||
+1
@@ -126,6 +126,7 @@ const MintSupplyTab: React.FC<MintSupplyTabProps> = ({
|
||||
/>
|
||||
|
||||
<TransactionButton
|
||||
client={contract.client}
|
||||
txChainID={contract.chain.id}
|
||||
transactionCount={1}
|
||||
isPending={sendAndConfirmTx.isPending}
|
||||
|
||||
+2
@@ -103,6 +103,7 @@ const TransferTab: React.FC<TransferTabProps> = ({
|
||||
<FormControl isRequired isInvalid={!!form.formState.errors.to}>
|
||||
<FormLabel>To Address</FormLabel>
|
||||
<SolidityInput
|
||||
client={contract.client}
|
||||
solidityType="address"
|
||||
formContext={form}
|
||||
placeholder={ZERO_ADDRESS}
|
||||
@@ -130,6 +131,7 @@ const TransferTab: React.FC<TransferTabProps> = ({
|
||||
)}
|
||||
</div>
|
||||
<TransactionButton
|
||||
client={contract.client}
|
||||
isLoggedIn={isLoggedIn}
|
||||
txChainID={contract.chain.id}
|
||||
transactionCount={1}
|
||||
|
||||
+2
@@ -252,6 +252,7 @@ export const UpdateNftMetadata: React.FC<UpdateNftMetadataForm> = ({
|
||||
<div className="flex flex-row flex-wrap gap-3">
|
||||
{nft?.metadata && !mediaFileUrl && (
|
||||
<NFTMediaWithEmptyState
|
||||
client={contract.client}
|
||||
metadata={{
|
||||
name: nft.metadata.name,
|
||||
animation_url:
|
||||
@@ -407,6 +408,7 @@ export const UpdateNftMetadata: React.FC<UpdateNftMetadataForm> = ({
|
||||
Cancel
|
||||
</Button>
|
||||
<TransactionButton
|
||||
client={contract.client}
|
||||
isLoggedIn={isLoggedIn}
|
||||
txChainID={contract.chain.id}
|
||||
transactionCount={1}
|
||||
|
||||
+9
-5
@@ -16,7 +16,6 @@ import { Button } from "@/components/ui/button";
|
||||
import { CodeClient } from "@/components/ui/code/code.client";
|
||||
import { TabButtons } from "@/components/ui/tabs";
|
||||
import { ToolTipLabel } from "@/components/ui/tooltip";
|
||||
import { useThirdwebClient } from "@/constants/thirdweb.client";
|
||||
import { resolveSchemeWithErrorHandler } from "@/lib/resolveSchemeWithErrorHandler";
|
||||
import { useChainSlug } from "hooks/chains/chainSlug";
|
||||
import { ExternalLinkIcon } from "lucide-react";
|
||||
@@ -78,8 +77,6 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
|
||||
accountAddress,
|
||||
});
|
||||
|
||||
const client = useThirdwebClient();
|
||||
|
||||
const { data: nft, isPending } = useReadContract(
|
||||
isErc721 ? getErc721NFT : getErc1155NFT,
|
||||
{
|
||||
@@ -129,7 +126,11 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
|
||||
{/* border */}
|
||||
<div className="absolute inset-0 z-0 rounded-lg border" />
|
||||
{/* media */}
|
||||
<NFTMediaWithEmptyState metadata={nftMetadata} className="z-10" />
|
||||
<NFTMediaWithEmptyState
|
||||
metadata={nftMetadata}
|
||||
className="z-10"
|
||||
client={contract.client}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex w-full flex-col gap-6">
|
||||
@@ -175,7 +176,9 @@ export const TokenIdPage: React.FC<TokenIdPageProps> = ({
|
||||
/>
|
||||
|
||||
{/* tab contents */}
|
||||
{tab === "Details" && <NFTDetailsTab nft={nft} client={client} />}
|
||||
{tab === "Details" && (
|
||||
<NFTDetailsTab nft={nft} client={contract.client} />
|
||||
)}
|
||||
|
||||
{tabs.map((tb) => {
|
||||
return (
|
||||
@@ -225,6 +228,7 @@ function NFTDetailsTab(props: {
|
||||
<div>
|
||||
<p className="mb-1 text-muted-foreground text-sm">Owner</p>
|
||||
<WalletAddress
|
||||
client={client}
|
||||
address={nft.owner}
|
||||
className="h-auto rounded-full border bg-card px-2 py-1 pr-4 text-foreground text-sm"
|
||||
/>
|
||||
|
||||
+1
@@ -68,6 +68,7 @@ export const BatchLazyMintButton: React.FC<BatchLazyMintButtonProps> = ({
|
||||
</SheetHeader>
|
||||
<BatchLazyMint
|
||||
isLoggedIn={isLoggedIn}
|
||||
client={contract.client}
|
||||
chainId={contract.chain.id}
|
||||
onSubmit={async ({ revealType, data }) => {
|
||||
// nice, we can set up everything the same for both the only thing that changes is the action string
|
||||
|
||||
+1
@@ -107,6 +107,7 @@ export const NFTClaimButton: React.FC<NFTClaimButtonProps> = ({
|
||||
</form>
|
||||
<div className="mt-4 flex justify-end">
|
||||
<TransactionButton
|
||||
client={contract.client}
|
||||
isLoggedIn={isLoggedIn}
|
||||
txChainID={contract.chain.id}
|
||||
transactionCount={1}
|
||||
|
||||
+1
@@ -341,6 +341,7 @@ export const LazyMintNftForm: React.FC<LazyMintNftFormParams> = ({
|
||||
Cancel
|
||||
</Button>
|
||||
<TransactionButton
|
||||
client={contract.client}
|
||||
isLoggedIn={isLoggedIn}
|
||||
txChainID={contract.chain.id}
|
||||
transactionCount={1}
|
||||
|
||||
+1
@@ -365,6 +365,7 @@ export const NFTMintForm: React.FC<NFTMintForm> = ({
|
||||
</Button>
|
||||
<TransactionButton
|
||||
txChainID={contract.chain.id}
|
||||
client={contract.client}
|
||||
transactionCount={1}
|
||||
isPending={sendAndConfirmTx.isPending}
|
||||
form={MINT_FORM_ID}
|
||||
|
||||
+1
@@ -153,6 +153,7 @@ export const NFTRevealButton: React.FC<NFTRevealButtonProps> = ({
|
||||
</form>
|
||||
<div className="mt-4 flex justify-end">
|
||||
<TransactionButton
|
||||
client={contract.client}
|
||||
isLoggedIn={isLoggedIn}
|
||||
txChainID={contract.chain.id}
|
||||
transactionCount={1}
|
||||
|
||||
+1
@@ -290,6 +290,7 @@ export const SharedMetadataForm: React.FC<{
|
||||
Cancel
|
||||
</Button>
|
||||
<TransactionButton
|
||||
client={contract.client}
|
||||
txChainID={contract.chain.id}
|
||||
transactionCount={1}
|
||||
isPending={sendAndConfirmTx.isPending}
|
||||
|
||||
+4
-4
@@ -75,7 +75,7 @@ export const NFTGetAllTable: React.FC<ContractOverviewNFTGetAllProps> = ({
|
||||
Header: "Media",
|
||||
accessor: (row) => row.metadata,
|
||||
Cell: (cell: CellProps<NFT, NFT["metadata"]>) => (
|
||||
<MediaCell cell={cell} />
|
||||
<MediaCell cell={cell} client={contract.client} />
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -133,7 +133,7 @@ export const NFTGetAllTable: React.FC<ContractOverviewNFTGetAllProps> = ({
|
||||
Header: "Owner",
|
||||
accessor: (row) => row.owner,
|
||||
Cell: (cell: CellProps<NFT, string>) => (
|
||||
<WalletAddress address={cell.value} />
|
||||
<WalletAddress address={cell.value} client={contract.client} />
|
||||
),
|
||||
});
|
||||
}
|
||||
@@ -153,7 +153,7 @@ export const NFTGetAllTable: React.FC<ContractOverviewNFTGetAllProps> = ({
|
||||
});
|
||||
}
|
||||
return cols;
|
||||
}, [isErc721, isErc1155]);
|
||||
}, [isErc721, isErc1155, contract.client]);
|
||||
|
||||
const [queryParams, setQueryParams] = useState({ count: 50, start: 0 });
|
||||
|
||||
@@ -278,7 +278,7 @@ export const NFTGetAllTable: React.FC<ContractOverviewNFTGetAllProps> = ({
|
||||
</Th>
|
||||
))}
|
||||
{/* Need to add an empty header for the drawer button */}
|
||||
<Th border="none" />
|
||||
<Th border="none" key="drawer" />
|
||||
</Tr>
|
||||
))}
|
||||
</Thead>
|
||||
|
||||
+18
@@ -1,3 +1,5 @@
|
||||
import { UpsellBannerCard } from "@/components/blocks/UpsellBannerCard";
|
||||
import { ExternalLinkIcon } from "lucide-react";
|
||||
import type { ThirdwebContract } from "thirdweb";
|
||||
import type { ProjectMeta } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/types";
|
||||
import { TokenDetailsCard } from "../tokens/components/supply";
|
||||
@@ -43,6 +45,22 @@ export const ContractOverviewPage: React.FC<ContractOverviewPageProps> = ({
|
||||
return (
|
||||
<div className="flex flex-col gap-10 lg:flex-row lg:gap-8">
|
||||
<div className="flex grow flex-col gap-10 overflow-hidden">
|
||||
{isErc20 && (
|
||||
<UpsellBannerCard
|
||||
title="Public asset page available"
|
||||
description="A public page is available for this contract for anyone to buy this asset"
|
||||
cta={{
|
||||
text: "View asset page",
|
||||
icon: <ExternalLinkIcon className="size-4" />,
|
||||
target: "_blank",
|
||||
link: `/${chainSlug}/${contract.address}`,
|
||||
}}
|
||||
trackingCategory="erc20-contract"
|
||||
trackingLabel="view-asset-page"
|
||||
accentColor="blue"
|
||||
/>
|
||||
)}
|
||||
|
||||
<ContractChecklist
|
||||
isErc721={isErc721}
|
||||
isErc1155={isErc1155}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user