Skip to content

Commit 3e45e9d

Browse files
committed
remove unused stuff
1 parent f61d0e0 commit 3e45e9d

File tree

4 files changed

+13
-121
lines changed

4 files changed

+13
-121
lines changed

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ export const tokenDistributionFormSchema = z.object({
3535
),
3636
// UI states
3737
airdropEnabled: z.boolean(),
38-
market: z.object({
39-
currencyAddress: addressSchema,
40-
priceAmount: priceAmountSchema,
41-
}),
4238
pool: z.object({
4339
startingPricePerToken: priceAmountSchema.refine((value) => {
4440
const numValue = Number(value);
@@ -64,7 +60,8 @@ export const tokenDistributionFormSchema = z.object({
6460
message: "Must be a number between 0 and 100",
6561
},
6662
),
67-
saleMode: z.enum(["market", "pool", "disabled"]),
63+
64+
saleMode: z.enum(["pool", "disabled"]),
6865
supply: z.string().min(1, "Supply is required"),
6966
});
7067

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/token/create-token-page-impl.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export function CreateTokenAssetPage(props: {
105105
launchConfig:
106106
params.values.saleMode === "pool" && saleAmount !== 0
107107
? {
108+
kind: "pool",
108109
config: {
109110
amount: BigInt(saleAmount),
110111
initialTick: getInitialTickValue({
@@ -113,8 +114,7 @@ export function CreateTokenAssetPage(props: {
113114
),
114115
}),
115116
referrerRewardBps: 5000, // 50%
116-
}, // public
117-
kind: "pool",
117+
},
118118
}
119119
: undefined,
120120
params: {

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/token/create-token-page.client.tsx

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
import { zodResolver } from "@hookform/resolvers/zod";
44
import { useState } from "react";
55
import { useForm } from "react-hook-form";
6-
import {
7-
getAddress,
8-
NATIVE_TOKEN_ADDRESS,
9-
type ThirdwebClient,
10-
} from "thirdweb";
6+
import type { ThirdwebClient } from "thirdweb";
117
import { useActiveWalletChain } from "thirdweb/react";
128
import { reportAssetCreationStepConfigured } from "@/analytics/report";
139
import type { Team } from "@/api/team";
@@ -34,8 +30,6 @@ export type CreateTokenFunctions = {
3430
airdropTokens: (values: CreateTokenFunctionsParams) => Promise<void>;
3531
};
3632

37-
const checksummedNativeTokenAddress = getAddress(NATIVE_TOKEN_ADDRESS);
38-
3933
export function CreateTokenAssetPageUI(props: {
4034
accountAddress: string;
4135
client: ThirdwebClient;
@@ -80,10 +74,6 @@ export function CreateTokenAssetPageUI(props: {
8074
airdropAddresses: [],
8175
// airdrop
8276
airdropEnabled: false,
83-
market: {
84-
currencyAddress: checksummedNativeTokenAddress,
85-
priceAmount: "0.1",
86-
},
8777
pool: {
8878
startingPricePerToken: "0.01",
8979
},
@@ -104,11 +94,7 @@ export function CreateTokenAssetPageUI(props: {
10494
client={props.client}
10595
form={tokenInfoForm}
10696
onChainUpdated={() => {
107-
// if the chain is updated, set the sale token address to the native token address
108-
tokenDistributionForm.setValue(
109-
"market.currencyAddress",
110-
checksummedNativeTokenAddress,
111-
);
97+
// no op
11298
}}
11399
onNext={() => {
114100
reportAssetCreationStepConfigured({

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/token/distribution/token-sale.tsx

Lines changed: 7 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type { ThirdwebClient } from "thirdweb";
77
import { defineChain } from "thirdweb";
88
import { isRouterEnabled } from "thirdweb/assets";
99
import { FormFieldSetup } from "@/components/blocks/FormFieldSetup";
10-
import { TokenSelector } from "@/components/blocks/TokenSelector";
1110
import { DynamicHeight } from "@/components/ui/DynamicHeight";
1211
import { DecimalInput } from "@/components/ui/decimal-input";
1312
import { Skeleton } from "@/components/ui/skeleton";
@@ -102,110 +101,20 @@ export function TokenSaleSection(props: {
102101
)}
103102
</div>
104103

105-
{isSaleEnabled && isRouterEnabledQuery.data === true && (
106-
<div className="space-y-5 pt-4">
107-
{saleMode === "market" && (
108-
<PrimarySaleConfig
109-
chainId={props.chainId}
110-
client={props.client}
111-
form={props.form}
112-
/>
113-
)}
114-
115-
{saleMode === "pool" && (
116-
<PoolConfig
117-
chainId={props.chainId}
118-
client={props.client}
119-
form={props.form}
120-
/>
121-
)}
104+
{saleMode === "pool" && isRouterEnabledQuery.data === true && (
105+
<div className="pt-4">
106+
<PoolConfig
107+
chainId={props.chainId}
108+
client={props.client}
109+
form={props.form}
110+
/>
122111
</div>
123112
)}
124113
</div>
125114
</DynamicHeight>
126115
);
127116
}
128117

129-
function PrimarySaleConfig(props: {
130-
form: TokenDistributionForm;
131-
chainId: string;
132-
client: ThirdwebClient;
133-
}) {
134-
const totalSupply = Number(props.form.watch("supply"));
135-
const sellSupply = Math.floor(
136-
(totalSupply * Number(props.form.watch("saleAllocationPercentage"))) / 100,
137-
);
138-
139-
return (
140-
<div className="grid grid-cols-1 gap-4 lg:grid-cols-2">
141-
{/* supply % */}
142-
<FormFieldSetup
143-
errorMessage={
144-
props.form.formState.errors.saleAllocationPercentage?.message
145-
}
146-
helperText={`${compactNumberFormatter.format(sellSupply)} tokens`}
147-
isRequired
148-
label="Sell % of Total Supply"
149-
>
150-
<div className="relative">
151-
<DecimalInput
152-
maxValue={100}
153-
onChange={(value) => {
154-
props.form.setValue("saleAllocationPercentage", value, {
155-
shouldValidate: true,
156-
});
157-
}}
158-
value={props.form.watch("saleAllocationPercentage")}
159-
/>
160-
<span className="-translate-y-1/2 absolute top-1/2 right-3 text-lg text-muted-foreground">
161-
%
162-
</span>
163-
</div>
164-
</FormFieldSetup>
165-
166-
{/* price amount + currency*/}
167-
<FormFieldSetup
168-
errorMessage={
169-
props.form.formState.errors.market?.priceAmount?.message ||
170-
props.form.formState.errors.market?.currencyAddress?.message
171-
}
172-
isRequired
173-
label="Price"
174-
>
175-
<div className="relative flex items-center">
176-
<DecimalInput
177-
className="rounded-r-none"
178-
onChange={(value) => {
179-
props.form.setValue("market.priceAmount", value, {
180-
shouldValidate: true,
181-
});
182-
}}
183-
value={props.form.watch("market.priceAmount")}
184-
/>
185-
186-
<TokenSelector
187-
addNativeTokenIfMissing={true}
188-
chainId={Number(props.chainId)}
189-
className="rounded-l-none border-l-0 bg-background"
190-
client={props.client}
191-
disableAddress={true}
192-
onChange={(value) => {
193-
props.form.setValue("market.currencyAddress", value.address, {
194-
shouldValidate: true,
195-
});
196-
}}
197-
selectedToken={{
198-
address: props.form.watch("market.currencyAddress"),
199-
chainId: Number(props.chainId),
200-
}}
201-
showCheck={true}
202-
/>
203-
</div>
204-
</FormFieldSetup>
205-
</div>
206-
);
207-
}
208-
209118
function PoolConfig(props: {
210119
form: TokenDistributionForm;
211120
chainId: string;

0 commit comments

Comments
 (0)