Skip to content

Commit 88e82aa

Browse files
committed
[TOOL-4689] Dashboard: Integrate ERC20Asset contract in token creation flow
1 parent 1e1314b commit 88e82aa

File tree

16 files changed

+368
-344
lines changed

16 files changed

+368
-344
lines changed

apps/dashboard/src/@/components/ui/tabs.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export function TabButtons(props: {
9898
shadowColor?: string;
9999
tabIconClassName?: string;
100100
hideBottomLine?: boolean;
101+
bottomLineClassName?: string;
101102
}) {
102103
const { containerRef, lineRef, activeTabRef } =
103104
useUnderline<HTMLButtonElement>();
@@ -106,7 +107,12 @@ export function TabButtons(props: {
106107
<div className={cn("relative", props.containerClassName)}>
107108
{/* Bottom line */}
108109
{!props.hideBottomLine && (
109-
<div className="absolute right-0 bottom-0 left-0 h-[1px] bg-border" />
110+
<div
111+
className={cn(
112+
"absolute right-0 bottom-0 left-0 h-[1px] bg-border",
113+
props.bottomLineClassName,
114+
)}
115+
/>
110116
)}
111117

112118
<ScrollShadow

apps/dashboard/src/@/constants/server-envs.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import "server-only";
2-
import { experimental_taintUniqueValue } from "react";
2+
import { experimental_taintUniqueValue as _experimental_taintUniqueValue } from "react";
33
import { isProd } from "./env-utils";
44

55
// Make sure to taint the server only envs here with experimental_taintUniqueValue ONLY if they contain a UNIQUE sensitive value
66
// if an env has a generic value that may appear naturally in client components - do not taint it
7+
const experimental_taintUniqueValue =
8+
_experimental_taintUniqueValue || (() => {});
79

810
export const DASHBOARD_THIRDWEB_SECRET_KEY =
911
process.env.DASHBOARD_SECRET_KEY || "";

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/_common/step-card.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export function StepCard(props: {
77
title: string;
88
tracking: {
99
page: string;
10-
contractType: "DropERC20" | "NFTCollection";
10+
contractType: "ERC20Asset" | "NFTCollection";
1111
};
1212
prevButton:
1313
| undefined
@@ -42,7 +42,7 @@ export function StepCard(props: {
4242
{props.children}
4343

4444
{(props.prevButton || props.nextButton) && (
45-
<div className="flex justify-end gap-3 border-t p-6">
45+
<div className="flex justify-end gap-3 border-t p-4 md:p-6">
4646
{props.prevButton && (
4747
<Button
4848
variant="outline"

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/token/_common/form.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ export const tokenInfoFormSchema = z.object({
1515
socialUrls: socialUrlsSchema,
1616
});
1717

18+
const priceAmountSchema = z.string().refine(
19+
(value) => {
20+
const number = Number(value);
21+
return !Number.isNaN(number) && number >= 0;
22+
},
23+
{
24+
message: "Must be number larger than or equal to 0",
25+
},
26+
);
27+
1828
export const tokenDistributionFormSchema = z.object({
1929
supply: z.string().min(1, "Supply is required"),
2030
saleAllocationPercentage: z.string().refine(
@@ -29,16 +39,13 @@ export const tokenDistributionFormSchema = z.object({
2939
message: "Must be a number between 0 and 100",
3040
},
3141
),
32-
saleTokenAddress: z.string(),
33-
salePrice: z.string().refine(
34-
(value) => {
35-
const number = Number(value);
36-
return !Number.isNaN(number) && number >= 0;
37-
},
38-
{
39-
message: "Must be number larger than or equal to 0",
40-
},
41-
),
42+
directSale: z.object({
43+
priceAmount: priceAmountSchema,
44+
currencyAddress: addressSchema,
45+
}),
46+
publicMarket: z.object({
47+
tradingFees: z.enum(["0.01", "0.05", "0.3", "1"]),
48+
}),
4249
airdropAddresses: z.array(
4350
z.object({
4451
address: addressSchema,
@@ -47,7 +54,7 @@ export const tokenDistributionFormSchema = z.object({
4754
),
4855
// UI states
4956
airdropEnabled: z.boolean(),
50-
saleEnabled: z.boolean(),
57+
saleMode: z.enum(["direct-sale", "public-market", "disabled"]),
5158
});
5259

5360
export type TokenDistributionForm = UseFormReturn<

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/assets/create/token/_common/tracking.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function getTokenDeploymentTrackingData(
1616
category: "custom-contract",
1717
action: "deploy",
1818
label: params.type,
19-
publisherAndContractName: "deployer.thirdweb.eth/DropERC20",
19+
publisherAndContractName: "deployer.thirdweb.eth/ERC20Asset",
2020
chainId: params.chainId,
2121
deploymentType: "asset",
2222
};
@@ -40,7 +40,7 @@ export function getTokenStepTrackingData(
4040
return {
4141
category: "asset",
4242
action: params.action,
43-
contractType: "DropERC20",
43+
contractType: "ERC20Asset",
4444
label: params.status,
4545
chainId: params.chainId,
4646
...(params.status === "error"
@@ -56,7 +56,7 @@ export function getTokenLaunchTrackingData(
5656
params: {
5757
chainId: number;
5858
airdropEnabled: boolean;
59-
saleEnabled: boolean;
59+
saleMode: "disabled" | "direct-sale" | "public-market";
6060
} & (
6161
| {
6262
type: "attempt" | "success";
@@ -71,10 +71,10 @@ export function getTokenLaunchTrackingData(
7171
category: "asset",
7272
action: "launch",
7373
label: params.type,
74-
contractType: "DropERC20",
74+
contractType: "ERC20Asset",
7575
chainId: params.chainId,
7676
airdropEnabled: params.airdropEnabled,
77-
saleEnabled: params.saleEnabled,
77+
saleMode: params.saleMode,
7878
...(params.type === "error"
7979
? {
8080
errorMessage: params.errorMessage,
@@ -87,7 +87,7 @@ export function getTokenLaunchTrackingData(
8787
export function getStepCardTrackingData(params: {
8888
step: string;
8989
click: "prev" | "next";
90-
contractType: "DropERC20" | "NFTCollection";
90+
contractType: "ERC20Asset" | "NFTCollection";
9191
}) {
9292
return {
9393
category: "asset",

0 commit comments

Comments
 (0)