Merge changes from legacy GUI, allow daemon logs to be attached to feedback (#115)

This PR applies all remaining changes from https://github.com/UnstoppableSwap/unstoppableswap-gui/pull/210


- Added checkbox option to attach daemon logs when submitting feedback
- Added "Outdated" chip with warning icon for providers running outdated asb versions
- Updated `BitcoinPunishedPage` to display different messages for BtcPunished and CooperativeRedeemRejected states (including reason for failed cooperative redeem)
- Added "Attempt recovery" button for swaps in BtcPunished state
- Modified `getBitcoinTxExplorerUrl` to use mempool.space instead of blockchair.com
- Added `useResumeableSwapsCountExcludingPunished` hook to count resumable swaps excluding punished ones, use it for the badge and alert
- Updated `sortProviderList` function to filter out incompatible providers before sorting
- Added `TauriSwapProgressEventExt` type to extract specific event types from TauriSwapProgressEvent
This commit is contained in:
binarybaron 2024-10-13 22:04:47 +06:00 committed by GitHub
parent 639f540876
commit 2bffe40a37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 116 additions and 50 deletions

View file

@ -1,5 +1,5 @@
import { Box } from "@material-ui/core";
import { SwapSlice, SwapState } from "models/storeModel";
import { SwapState } from "models/storeModel";
import CircularProgressWithSubtitle from "../CircularProgressWithSubtitle";
import BitcoinPunishedPage from "./done/BitcoinPunishedPage";
import BitcoinRefundedPage from "./done/BitcoinRefundedPage";
@ -52,7 +52,7 @@ export default function SwapStatePage({ state }: { state: SwapState | null }) {
case "BtcRefunded":
return <BitcoinRefundedPage {...state.curr.content} />;
case "BtcPunished":
return <BitcoinPunishedPage />;
return <BitcoinPunishedPage state={state.curr} />;
case "AttemptingCooperativeRedeem":
return (
<CircularProgressWithSubtitle description="Attempting to redeem the Monero with the help of the other party" />
@ -62,7 +62,7 @@ export default function SwapStatePage({ state }: { state: SwapState | null }) {
<CircularProgressWithSubtitle description="The other party is cooperating with us to redeem the Monero..." />
);
case "CooperativeRedeemRejected":
return <BitcoinPunishedPage />;
return <BitcoinPunishedPage state={state.curr} />;
case "Released":
return <ProcessExitedPage prevState={state.prev} swapId={state.swapId} />;
default:

View file

@ -1,13 +1,27 @@
import { Box, DialogContentText } from "@material-ui/core";
import FeedbackInfoBox from "../../../../pages/help/FeedbackInfoBox";
import { Box, DialogContentText } from '@material-ui/core';
import FeedbackInfoBox from '../../../../pages/help/FeedbackInfoBox';
import { TauriSwapProgressEventExt } from 'models/tauriModelExt';
export default function BitcoinPunishedPage() {
export default function BitcoinPunishedPage({
state,
}: {
state: TauriSwapProgressEventExt<"BtcPunished"> | TauriSwapProgressEventExt<"CooperativeRedeemRejected">
}) {
return (
<Box>
<DialogContentText>
Unfortunately, the swap was not successful, and you&apos;ve incurred a
penalty because the swap was not refunded in time. Both the Bitcoin and
Monero are irretrievable.
Unfortunately, the swap was unsuccessful. Since you did not refund in
time, the Bitcoin has been lost. However, with the cooperation of the
other party, you might still be able to redeem the Monero, although this
is not guaranteed.{' '}
{state.type === "CooperativeRedeemRejected" && (
<>
<br />
We tried to redeem the Monero with the other party's help, but it
was unsuccessful (reason: {state.content.reason}). Attempting again at a
later time might yield success. <br />
</>
)}
</DialogContentText>
<FeedbackInfoBox />
</Box>