From ffd0c86e54339d41a8bff0da8ce64fea0235992e Mon Sep 17 00:00:00 2001 From: Pedro Yves Fracari Date: Wed, 4 Dec 2024 10:20:04 -0300 Subject: [PATCH] fix cow amm submition --- apps/withdraw-cow-amm/src/app/layout.tsx | 11 +++-------- .../src/context/withdrawHookForm.tsx | 12 ++++-------- packages/cow-hooks-ui/src/context/index.tsx | 1 - 3 files changed, 7 insertions(+), 17 deletions(-) rename {packages/cow-hooks-ui => apps/withdraw-cow-amm}/src/context/withdrawHookForm.tsx (86%) diff --git a/apps/withdraw-cow-amm/src/app/layout.tsx b/apps/withdraw-cow-amm/src/app/layout.tsx index 7540886..f7ab4d9 100644 --- a/apps/withdraw-cow-amm/src/app/layout.tsx +++ b/apps/withdraw-cow-amm/src/app/layout.tsx @@ -1,25 +1,20 @@ "use client"; -import { RootLayout, WithdrawFormContextProvider } from "@bleu/cow-hooks-ui"; -import { useGetHookInfo } from "#/hooks/useGetHookInfo"; +import { RootLayout } from "@bleu/cow-hooks-ui"; +import { WithdrawFormContextProvider } from "#/context/withdrawHookForm"; import "@bleu/cow-hooks-ui/global.css"; import Head from "next/head"; import type * as React from "react"; export default function Layout({ children }: { children: React.ReactNode }) { - const getHookInfo = useGetHookInfo(); - return ( - + {children} diff --git a/packages/cow-hooks-ui/src/context/withdrawHookForm.tsx b/apps/withdraw-cow-amm/src/context/withdrawHookForm.tsx similarity index 86% rename from packages/cow-hooks-ui/src/context/withdrawHookForm.tsx rename to apps/withdraw-cow-amm/src/context/withdrawHookForm.tsx index be85a9a..5f70dbf 100644 --- a/packages/cow-hooks-ui/src/context/withdrawHookForm.tsx +++ b/apps/withdraw-cow-amm/src/context/withdrawHookForm.tsx @@ -1,27 +1,23 @@ "use client"; +import { useIFrameContext } from "@bleu/cow-hooks-ui/src/context/iframe"; +import { useUserPools } from "@bleu/cow-hooks-ui/src/hooks/useUserPools"; import { Form } from "@bleu/ui"; import { type WithdrawSchemaType, withdrawSchema } from "@bleu/utils"; import { zodResolver } from "@hookform/resolvers/zod"; import { useRouter } from "next/navigation"; import { useCallback, useEffect, useMemo } from "react"; import { useForm, useWatch } from "react-hook-form"; -import { useUserPools } from "../hooks/useUserPools"; -import type { IHooksInfo, IPool } from "../types"; -import { useIFrameContext } from "./iframe"; +import { useGetHookInfo } from "#/hooks/useGetHookInfo"; export function WithdrawFormContextProvider({ children, - getHookInfo, poolTypeIn, }: { children: React.ReactNode; - getHookInfo: ( - selectedPool: IPool, - withdrawPct: number, - ) => Promise; poolTypeIn: "COW_AMM" | "WEIGHTED"; }) { + const getHookInfo = useGetHookInfo(); const { context, setHookInfo } = useIFrameContext(); const form = useForm({ diff --git a/packages/cow-hooks-ui/src/context/index.tsx b/packages/cow-hooks-ui/src/context/index.tsx index 133bcab..9537785 100644 --- a/packages/cow-hooks-ui/src/context/index.tsx +++ b/packages/cow-hooks-ui/src/context/index.tsx @@ -1,3 +1,2 @@ export * from "./iframe"; export * from "./tokenLogo"; -export * from "./withdrawHookForm";