Skip to content

Commit 80c28a4

Browse files
committed
fix: token form submission
1 parent a983665 commit 80c28a4

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
lines changed

apps/dashboard/src/@/api/universal-bridge/tokens.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use server";
22
import { DASHBOARD_THIRDWEB_SECRET_KEY } from "@/constants/server-envs";
3+
import type { ProjectResponse } from "@thirdweb-dev/service-utils";
34
import { getAuthToken } from "app/(app)/api/lib/getAuthToken";
45
import { UB_BASE_URL } from "./constants";
56

@@ -40,8 +41,9 @@ export async function getUniversalBridgeTokens(props: {
4041
}
4142

4243
export async function addUniversalBridgeTokenRoute(props: {
43-
chainId?: number;
44-
tokenAddress?: string;
44+
chainId: number;
45+
tokenAddress: string;
46+
project: ProjectResponse;
4547
}) {
4648
const authToken = await getAuthToken();
4749
const url = new URL(`${UB_BASE_URL}/v1/tokens`);
@@ -51,6 +53,7 @@ export async function addUniversalBridgeTokenRoute(props: {
5153
headers: {
5254
"Content-Type": "application/json",
5355
Authorization: `Bearer ${authToken}`,
56+
"x-client-id": props.project.publishableKey,
5457
} as Record<string, string>,
5558
body: JSON.stringify({
5659
chainId: props.chainId,

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/connect/universal-bridge/settings/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default async function Page(props: {
5858
/>
5959

6060
<div className="flex pt-5">
61-
<RouteDiscovery />
61+
<RouteDiscovery project={project} />
6262
</div>
6363
</div>
6464
);

apps/dashboard/src/components/pay/RouteDiscovery.tsx

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
import { Input } from "@/components/ui/input";
1212
import { zodResolver } from "@hookform/resolvers/zod";
1313
import { useMutation } from "@tanstack/react-query";
14+
import type { ProjectResponse } from "@thirdweb-dev/service-utils";
1415
import { NetworkSelectorButton } from "components/selects/NetworkSelectorButton";
1516
import {
1617
type RouteDiscoveryValidationSchema,
@@ -22,7 +23,7 @@ import { toast } from "sonner";
2223

2324
const TRACKING_CATEGORY = "token_discovery";
2425

25-
export const RouteDiscovery: React.FC = () => {
26+
export const RouteDiscovery = ({ project }: { project: ProjectResponse }) => {
2627
const form = useForm<RouteDiscoveryValidationSchema>({
2728
resolver: zodResolver(routeDiscoveryValidationSchema),
2829
defaultValues: {
@@ -31,10 +32,6 @@ export const RouteDiscovery: React.FC = () => {
3132
},
3233
});
3334

34-
const resetForm = () => {
35-
form.reset();
36-
};
37-
3835
const trackEvent = useTrack();
3936

4037
const submitDiscoveryMutation = useMutation({
@@ -46,6 +43,7 @@ export const RouteDiscovery: React.FC = () => {
4643
const result = await addUniversalBridgeTokenRoute({
4744
chainId: values.chainId,
4845
tokenAddress: values.tokenAddress,
46+
project,
4947
});
5048

5149
return result;
@@ -64,10 +62,6 @@ export const RouteDiscovery: React.FC = () => {
6462
toast.success("Token submitted successfully!", {
6563
description:
6664
"Thank you for your submission. Contact support if your token doesn't appear after some time.",
67-
action: {
68-
label: "Submit Another token",
69-
onClick: () => resetForm(),
70-
},
7165
});
7266
trackEvent({
7367
category: TRACKING_CATEGORY,
@@ -83,10 +77,6 @@ export const RouteDiscovery: React.FC = () => {
8377
toast.error("Token submission failed!", {
8478
description:
8579
"Please double check the network and token address. If issues persist, please reach out to our support team.",
86-
action: {
87-
label: "Try Again",
88-
onClick: () => resetForm(),
89-
},
9080
});
9181

9282
// Get appropriate error message

0 commit comments

Comments
 (0)