Skip to content

Commit f9de94c

Browse files
committed
fix: load swap fee
1 parent fefd738 commit f9de94c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

api/src/models/dex.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,15 @@ export const dexFormSchema = dexSchema
373373
.optional(),
374374
swapFeeBps: z
375375
.union([
376-
z.number().int(),
376+
z.number().int().min(0).max(100),
377377
z.string().transform(val => {
378378
if (!val || val.trim() === "") return null;
379379
const parsed = parseInt(val, 10);
380-
return isNaN(parsed) ? null : parsed;
380+
if (isNaN(parsed)) return null;
381+
if (parsed < 0 || parsed > 100) {
382+
throw new Error("Swap fee must be between 0 and 100 bps (1%)");
383+
}
384+
return parsed;
381385
}),
382386
z.null(),
383387
])

app/app/hooks/useDexForm.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,7 @@ export function useDexForm(): UseDexFormReturn {
840840
enableServiceDisclaimerDialog:
841841
response.enableServiceDisclaimerDialog || false,
842842
enableCampaigns: response.enableCampaigns || false,
843+
swapFeeBps: response.swapFeeBps ?? null,
843844
chainIds: response.chainIds || [],
844845
defaultChain: response.defaultChain || undefined,
845846
disableMainnet: response.disableMainnet || false,
@@ -855,6 +856,7 @@ export function useDexForm(): UseDexFormReturn {
855856
seoTwitterHandle: response.seoTwitterHandle || "",
856857
seoThemeColor: response.seoThemeColor || "",
857858
seoKeywords: response.seoKeywords || "",
859+
analyticsScript: response.analyticsScript || "",
858860
themeCSS: response.themeCSS,
859861
});
860862

0 commit comments

Comments
 (0)