From 4a9e90f99a2f25f1af6e667e59841d6d6fb2f8e6 Mon Sep 17 00:00:00 2001 From: Binarybaron Date: Wed, 5 Nov 2025 19:15:28 +0100 Subject: [PATCH] amend: remove more dead frontend code --- src-gui/package.json | 2 +- src-gui/src/models/rpcModel.ts | 110 +----------------- .../pages/help/ConversationsBox.tsx | 1 - 3 files changed, 2 insertions(+), 111 deletions(-) diff --git a/src-gui/package.json b/src-gui/package.json index cc213d95..2d66e3e9 100644 --- a/src-gui/package.json +++ b/src-gui/package.json @@ -32,7 +32,6 @@ "@tauri-apps/plugin-shell": "^2.3.0", "@tauri-apps/plugin-store": "^2.4.0", "@tauri-apps/plugin-updater": "^2.9.0", - "@types/react-redux": "^7.1.34", "boring-avatars": "^1.11.2", "dayjs": "^1.11.13", "humanize-duration": "^3.32.1", @@ -49,6 +48,7 @@ "virtua": "^0.33.2" }, "devDependencies": { + "@types/react-redux": "^7.1.34", "@eslint/js": "^9.9.0", "@redux-devtools/remote": "^0.9.5", "@tauri-apps/cli": "^2.0.0", diff --git a/src-gui/src/models/rpcModel.ts b/src-gui/src/models/rpcModel.ts index 57f94609..81aa8899 100644 --- a/src-gui/src/models/rpcModel.ts +++ b/src-gui/src/models/rpcModel.ts @@ -1,112 +1,4 @@ -export enum RpcMethod { - GET_BTC_BALANCE = "get_bitcoin_balance", - WITHDRAW_BTC = "withdraw_btc", - BUY_XMR = "buy_xmr", - RESUME_SWAP = "resume_swap", - LIST_SELLERS = "list_sellers", - CANCEL_REFUND_SWAP = "cancel_refund_swap", - GET_SWAP_INFO = "get_swap_info", - SUSPEND_CURRENT_SWAP = "suspend_current_swap", - GET_HISTORY = "get_history", - GET_MONERO_RECOVERY_KEYS = "get_monero_recovery_info", -} - -export enum RpcProcessStateType { - STARTED = "starting...", - LISTENING_FOR_CONNECTIONS = "running", - EXITED = "exited", - NOT_STARTED = "not started", -} - -export type RawRpcResponseSuccess = { - jsonrpc: string; - id: string; - result: T; -}; - -export type RawRpcResponseError = { - jsonrpc: string; - id: string; - error: { code: number; message: string }; -}; - -export type RawRpcResponse = RawRpcResponseSuccess | RawRpcResponseError; - -export function isSuccessResponse( - response: RawRpcResponse, -): response is RawRpcResponseSuccess { - return "result" in response; -} - -export function isErrorResponse( - response: RawRpcResponse, -): response is RawRpcResponseError { - return "error" in response; -} - -export interface RpcSellerStatus { - status: - | { - Online: { - price: number; - min_quantity: number; - max_quantity: number; - }; - } - | "Unreachable"; - multiaddr: string; -} - -export interface WithdrawBitcoinResponse { - txid: string; -} - -export interface BuyXmrResponse { - swapId: string; -} - -export type SwapTimelockInfoNone = { - None: { - blocks_left: number; - }; -}; - -export type SwapTimelockInfoCancelled = { - Cancel: { - blocks_left: number; - }; -}; - -export type SwapTimelockInfoPunished = "Punish"; - -export type SwapTimelockInfo = - | SwapTimelockInfoNone - | SwapTimelockInfoCancelled - | SwapTimelockInfoPunished; - -export function isSwapTimelockInfoNone( - info: SwapTimelockInfo, -): info is SwapTimelockInfoNone { - return typeof info === "object" && "None" in info; -} - -export function isSwapTimelockInfoCancelled( - info: SwapTimelockInfo, -): info is SwapTimelockInfoCancelled { - return typeof info === "object" && "Cancel" in info; -} - -export function isSwapTimelockInfoPunished( - info: SwapTimelockInfo, -): info is SwapTimelockInfoPunished { - return info === "Punish"; -} - -export type SwapSellerInfo = { - peerId: string; - addresses: string[]; -}; - +// TODO: Auto generate this using typeshare from swap/src/cli/api/request.rs export type MoneroRecoveryResponse = { address: string; spend_key: string; diff --git a/src-gui/src/renderer/components/pages/help/ConversationsBox.tsx b/src-gui/src/renderer/components/pages/help/ConversationsBox.tsx index edc56b6f..def0072b 100644 --- a/src-gui/src/renderer/components/pages/help/ConversationsBox.tsx +++ b/src-gui/src/renderer/components/pages/help/ConversationsBox.tsx @@ -29,7 +29,6 @@ import ChatIcon from "@mui/icons-material/Chat"; import SendIcon from "@mui/icons-material/Send"; import InfoBox from "renderer/components/pages/swap/swap/components/InfoBox"; import TruncatedText from "renderer/components/other/TruncatedText"; -import clsx from "clsx"; import { useAppSelector, useAppDispatch,