diff --git a/src/views/wallet/receive.tsx b/src/views/wallet/receive.tsx deleted file mode 100644 index 31d6350c0..000000000 --- a/src/views/wallet/receive.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import { useState } from "react"; -import { useActionHub } from "applesauce-react/hooks"; -import { Button, Flex, Spacer, Textarea, useToast } from "@chakra-ui/react"; -import { getDecodedToken, Token } from "@cashu/cashu-ts"; -import { ReceiveToken } from "applesauce-wallet/actions"; -import { useLocation, useNavigate } from "react-router-dom"; - -import SimpleView from "../../components/layout/presets/simple-view"; -import { getCashuWallet } from "../../services/cashu-mints"; -import RouterLink from "../../components/router-link"; -import QRCodeScannerButton from "../../components/qr-code/qr-code-scanner-button"; - -export default function WalletReceiveView() { - const location = useLocation(); - const actions = useActionHub(); - const navigate = useNavigate(); - const toast = useToast(); - - const [input, setInput] = useState(location.state?.input ?? ""); - - const [loading, setLoading] = useState(false); - const receive = async () => { - setLoading(true); - try { - const decoded = getDecodedToken(input.trim()); - const originalAmount = decoded.proofs.reduce((t, p) => t + p.amount, 0); - - // swap tokens - const wallet = await getCashuWallet(decoded.mint); - const proofs = await wallet.receive(decoded); - const token: Token = { mint: decoded.mint, proofs }; - - const amount = token.proofs.reduce((t, p) => t + p.amount, 0); - const fee = originalAmount - amount; - - // save new tokens - await actions.run(ReceiveToken, token, undefined, fee || undefined); - - toast({ status: "success", description: `Received ${amount} sats` }); - - navigate("/wallet"); - } catch (error) { - if (error instanceof Error) toast({ status: "error", description: error.message }); - console.log(error); - } - setLoading(false); - }; - - return ( - -