diff --git a/app/components/change-autoswap-settings.tsx b/app/components/change-autoswap-settings.tsx deleted file mode 100644 index bfa25a6..0000000 --- a/app/components/change-autoswap-settings.tsx +++ /dev/null @@ -1,120 +0,0 @@ -import React, { useCallback, useEffect, useState } from "react"; -import { EditIcon } from "lucide-react"; -import { createSubscription, useContractWriteUtility } from "../utils/helper"; -import { swappr_contract_address } from "../utils/addresses"; -import { STRK_TOKEN, USDT_TOKEN } from "../utils/data"; -import { ERC20_ABI } from "../abis/erc20-abi"; -import { useAccount } from "@starknet-react/core"; -import { useRouter } from "next/navigation"; -import GrantPermission from "./ui/modals/grant-permission-modal"; -import GenericModal from "./generic-modal"; - -export default function ChangeAutoswapSettings({ - handleClose, -}: { - handleClose: () => void; -}) { - const { address } = useAccount(); - const router = useRouter(); - const [newSwapAmount, setNewSwapAmount] = useState(""); - const [isPermissionModalOpen, setIsPermissionModalOpen] = useState(false); - - const { writeAsync, waitData } = useContractWriteUtility( - "approve", - [ - swappr_contract_address, - newSwapAmount - ? BigInt(newSwapAmount) * BigInt(10 ** STRK_TOKEN.decimals) - : BigInt(0), - ], - ERC20_ABI, - STRK_TOKEN.contractAddress - ); - - useEffect(() => { - if (!waitData || !address) return; - - const subscribe = async () => { - try { - await createSubscription({ - wallet_address: address, - to_token: USDT_TOKEN.contractAddress, - from_token: STRK_TOKEN.contractAddress, - swap_amount: Number(newSwapAmount), - }); - setIsPermissionModalOpen(false); - router.push("/overview"); - } catch (error) { - console.error("Subscription error:", error); - } - }; - - subscribe(); - }, [waitData, address, router, newSwapAmount]); - - const handleSubscribe = useCallback(async () => { - try { - await writeAsync(); - } catch (error) { - console.error("Error approving swap:", error); - } - }, [writeAsync]); - return ( - <> - setIsPermissionModalOpen((prev) => !prev)} - open={isPermissionModalOpen} - handleSubmit={handleSubscribe} - /> - - -

- Change Autoswap Settings -

-
-
-

- Current threshold amount: -

-
- - 3000 STRK -
-
- -
-

- Input the new threshold you want to autoswap -

-
- setNewSwapAmount(e.target.value)} - required - /> - -
-
-
- -
- - ); -} diff --git a/app/components/footer.tsx b/app/components/footer.tsx index d119559..53ce0c9 100644 --- a/app/components/footer.tsx +++ b/app/components/footer.tsx @@ -21,9 +21,9 @@ export const footerLinks: { name: string; path: string }[] = [ export default function Footer() { return ( -