Skip to content

refactor(swap, gui): Move redeem/refund input page to the end#479

Closed
b-enedict wants to merge 7 commits intomasterfrom
refactor/later-monero-and-bitcoin-address-step
Closed

refactor(swap, gui): Move redeem/refund input page to the end#479
b-enedict wants to merge 7 commits intomasterfrom
refactor/later-monero-and-bitcoin-address-step

Conversation

@b-enedict
Copy link
Copy Markdown

@b-enedict b-enedict commented Jul 23, 2025

Note

Adds a new SelectOffer approval to collect redeem/refund addresses after maker selection, refactoring buy/start flow in backend and GUI to show an address input step and removing pre-swap address inputs.

  • Backend (Rust):
    • New approval type: ApprovalRequestType::SelectOffer with SelectOfferDetails and SelectOfferApprovalRequest; TauriEmitter.request_specify_redeem_refund added.
    • Flow change: buy_xmr no longer takes addresses; after offer selection it requests redeem/refund addresses, validates/stores them, then starts swap.
    • API updates: determine_btc_to_swap now returns QuoteWithAddress (single tuple element); consumers adjusted. CLI comment hints at future passing of change addr.
  • GUI (TS/React):
    • New page: AddressInputPage to input external Monero redeem and BTC refund addresses (with internal-wallet switches); shown when pending SelectOffer approval.
    • Flow refactor: Removed InitPage; SwapStatePage prioritizes pending SelectOffer by rendering AddressInputPage. SwapWidget auto-starts buyXmr() on null state, adds loading Skeleton, and hides cancel during deposit/address input.
    • Approvals/hooks: Added usePendingSelectOfferApproval; sorting utilities extended for selectable offers (and SortableQuoteWithAddress).
    • Inputs: BitcoinAddressTextField and MoneroAddressTextField converted to forwardRef; Monero field keeps recent addresses dialog.
    • UI tweaks: MakerOfferItem supports noButton; SwapSetupInflightPage hides confirm while address selection pending.
    • RPC: Simplified buyXmr() (no addresses); added confirmOfferWithAddresses() to resolve SelectOffer with chosen addresses; improved init logging.

Written by Cursor Bugbot for commit bf10c34. This will update automatically on new commits. Configure here.

coderabbitai[bot]

This comment was marked as off-topic.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
swap/src/cli/api/request.rs (1)

1038-1040: Essential validation for security.

The validation calls assert_network and assert_sum_to_one are crucial for ensuring the Monero receive pool is properly configured and secure.

🧹 Nitpick comments (2)
src-gui/src/renderer/components/pages/swap/swap/SwapWidget.tsx (1)

87-87: Complex conditional logic for CancelButton - consider refactoring

The condition !(isWaitingForBtcDeposit && !isSelectedSwapOffer) is logically equivalent to !isWaitingForBtcDeposit || isSelectedSwapOffer but may be harder to understand. Consider extracting this to a well-named boolean variable for clarity.

+  const shouldShowCancelButton = !isWaitingForBtcDeposit || isSelectedSwapOffer;
+
   <Box
     sx={{
       display: "flex",
       alignItems: "center",
       justifyContent: isWaitingForBtcDeposit
         ? "flex-end"
         : "space-between",
     }}
   >
-    {!(isWaitingForBtcDeposit && !isSelectedSwapOffer) && <CancelButton />}
+    {shouldShowCancelButton && <CancelButton />}
     <DebugPageSwitchBadge enabled={debug} setEnabled={setDebug} />
   </Box>
src-gui/src/renderer/rpc.ts (1)

250-253: Type casting is necessary but could be improved.

The cast to SelectOfferApprovalRequest is required for API integration, but using as unknown as suggests a type mismatch. Consider ensuring the constructed object fully matches the expected interface.

await resolveApproval(requestId, {
  bitcoin_change_address: btc_change_address,
  monero_receive_pool: address_pool,
} satisfies SelectOfferApprovalRequest);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a4cdafd and f012601.

⛔ Files ignored due to path filters (33)
  • src-tauri/gen/apple/.gitignore is excluded by !**/gen/**
  • src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/[email protected] is excluded by !**/*.png, !**/gen/**
  • src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/[email protected] is excluded by !**/*.png, !**/gen/**
  • src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/[email protected] is excluded by !**/*.png, !**/gen/**
  • src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/[email protected] is excluded by !**/*.png, !**/gen/**
  • src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/[email protected] is excluded by !**/*.png, !**/gen/**
  • src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/[email protected] is excluded by !**/*.png, !**/gen/**
  • src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/[email protected] is excluded by !**/*.png, !**/gen/**
  • src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/[email protected] is excluded by !**/*.png, !**/gen/**
  • src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/[email protected] is excluded by !**/*.png, !**/gen/**
  • src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/[email protected] is excluded by !**/*.png, !**/gen/**
  • src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/[email protected] is excluded by !**/*.png, !**/gen/**
  • src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/[email protected] is excluded by !**/*.png, !**/gen/**
  • src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/[email protected] is excluded by !**/*.png, !**/gen/**
  • src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/[email protected] is excluded by !**/*.png, !**/gen/**
  • src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/[email protected] is excluded by !**/*.png, !**/gen/**
  • src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/[email protected] is excluded by !**/*.png, !**/gen/**
  • src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/[email protected] is excluded by !**/*.png, !**/gen/**
  • src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/[email protected] is excluded by !**/*.png, !**/gen/**
  • src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/Contents.json is excluded by !**/gen/**
  • src-tauri/gen/apple/Assets.xcassets/Contents.json is excluded by !**/gen/**
  • src-tauri/gen/apple/ExportOptions.plist is excluded by !**/gen/**
  • src-tauri/gen/apple/LaunchScreen.storyboard is excluded by !**/gen/**
  • src-tauri/gen/apple/Podfile is excluded by !**/gen/**
  • src-tauri/gen/apple/Sources/unstoppableswap-gui-rs/bindings/bindings.h is excluded by !**/gen/**
  • src-tauri/gen/apple/Sources/unstoppableswap-gui-rs/main.mm is excluded by !**/gen/**
  • src-tauri/gen/apple/project.yml is excluded by !**/gen/**
  • src-tauri/gen/apple/unstoppableswap-gui-rs.xcodeproj/project.pbxproj is excluded by !**/gen/**
  • src-tauri/gen/apple/unstoppableswap-gui-rs.xcodeproj/project.xcworkspace/contents.xcworkspacedata is excluded by !**/gen/**
  • src-tauri/gen/apple/unstoppableswap-gui-rs.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings is excluded by !**/gen/**
  • src-tauri/gen/apple/unstoppableswap-gui-rs.xcodeproj/xcshareddata/xcschemes/unstoppableswap-gui-rs_iOS.xcscheme is excluded by !**/gen/**
  • src-tauri/gen/apple/unstoppableswap-gui-rs_iOS/Info.plist is excluded by !**/gen/**
  • src-tauri/gen/apple/unstoppableswap-gui-rs_iOS/unstoppableswap-gui-rs_iOS.entitlements is excluded by !**/gen/**
📒 Files selected for processing (12)
  • src-gui/src/models/storeModel.ts (1 hunks)
  • src-gui/src/renderer/components/pages/swap/swap/SwapStatePage.tsx (3 hunks)
  • src-gui/src/renderer/components/pages/swap/swap/SwapWidget.tsx (2 hunks)
  • src-gui/src/renderer/components/pages/swap/swap/init/AddressInputPage.tsx (3 hunks)
  • src-gui/src/renderer/components/pages/swap/swap/init/deposit_and_choose_offer/DepositAndChooseOfferPage.tsx (2 hunks)
  • src-gui/src/renderer/components/pages/swap/swap/init/deposit_and_choose_offer/MakerOfferItem.tsx (2 hunks)
  • src-gui/src/renderer/rpc.ts (4 hunks)
  • src-gui/src/store/features/swapSlice.ts (2 hunks)
  • src-tauri/tauri.conf.json.backup (1 hunks)
  • swap/src/cli/api/request.rs (9 hunks)
  • swap/src/cli/api/tauri_bindings.rs (5 hunks)
  • swap/src/cli/command.rs (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src-tauri/tauri.conf.json.backup
🚧 Files skipped from review as they are similar to previous changes (2)
  • swap/src/cli/command.rs
  • swap/src/cli/api/tauri_bindings.rs
🧰 Additional context used
🧬 Code Graph Analysis (6)
src-gui/src/renderer/components/pages/swap/swap/SwapStatePage.tsx (4)
src-gui/src/store/hooks.ts (2)
  • useAppDispatch (34-34)
  • useAppSelector (35-35)
src-gui/src/renderer/components/pages/swap/swap/init/AddressInputPage.tsx (1)
  • AddressInputPage (10-139)
src-gui/src/store/features/swapSlice.ts (1)
  • setSelectedOfferPeerId (41-43)
src-gui/src/renderer/components/pages/swap/swap/init/deposit_and_choose_offer/DepositAndChooseOfferPage.tsx (1)
  • DepositAndChooseOfferPage (12-163)
src-gui/src/renderer/components/pages/swap/swap/init/deposit_and_choose_offer/DepositAndChooseOfferPage.tsx (1)
src-gui/src/models/tauriModelExt.ts (1)
  • TauriSwapProgressEventContent (16-18)
src-gui/src/renderer/components/pages/swap/swap/SwapWidget.tsx (6)
src-gui/src/store/hooks.ts (2)
  • useAppSelector (35-35)
  • useActiveSwapInfo (133-136)
src-gui/src/renderer/rpc.ts (1)
  • buyXmr (199-216)
src-gui/src/renderer/components/pages/swap/swap/SwapStatePage.tsx (1)
  • SwapStatePage (29-146)
src-gui/src/renderer/components/modal/swap/SwapStateStepper.tsx (1)
  • SwapStateStepper (176-195)
src-gui/src/renderer/components/pages/swap/swap/CancelButton.tsx (1)
  • CancelButton (9-51)
src-gui/src/renderer/components/modal/swap/pages/DebugPageSwitchBadge.tsx (1)
  • DebugPageSwitchBadge (5-27)
src-gui/src/renderer/components/pages/swap/swap/init/AddressInputPage.tsx (3)
src-gui/src/store/hooks.ts (1)
  • usePendingSelectMakerApproval (219-222)
src-gui/src/renderer/rpc.ts (1)
  • resolveSelectMakerApproval (218-254)
src-gui/src/store/features/swapSlice.ts (1)
  • setSelectedOfferPeerId (41-43)
swap/src/cli/api/request.rs (1)
swap/src/cli/api/tauri_bindings.rs (1)
  • request_approval (237-348)
src-gui/src/renderer/rpc.ts (2)
src-gui/src/models/rpcModel.ts (1)
  • BuyXmrResponse (64-66)
src-gui/src/store/features/settingsSlice.ts (1)
  • DonateToDevelopmentTip (4-4)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: test (macos-latest)
  • GitHub Check: build (x86_64-apple-darwin, macos-13)
  • GitHub Check: build (aarch64-apple-darwin, macos-latest)
🔇 Additional comments (29)
src-gui/src/models/storeModel.ts (1)

14-14: LGTM: Clean interface extension

The addition of selectedOfferPeerId: string | null properly extends the SwapSlice interface to track the selected offer peer ID. The nullable type correctly represents optional selection state.

src-gui/src/store/features/swapSlice.ts (3)

11-11: LGTM: Proper Redux state initialization

The selectedOfferPeerId: null initialization correctly establishes the default state for tracking selected offers.


41-43: LGTM: Well-implemented Redux reducer

The setSelectedOfferPeerId reducer correctly handles both setting a peer ID string and clearing the selection with null. The implementation follows Redux Toolkit best practices.


47-47: LGTM: Proper action export

The setSelectedOfferPeerId action is correctly included in the exported actions for use in components.

src-gui/src/renderer/components/pages/swap/swap/init/deposit_and_choose_offer/DepositAndChooseOfferPage.tsx (2)

16-19: LGTM: Well-typed callback prop

The onSelectOffer prop is properly typed with a clear function signature (peerId: string) => void and correctly extends the existing type interface.


129-129: LGTM: Proper callback propagation

The onSelectOffer callback is correctly passed down to the MakerOfferItem components, enabling proper offer selection handling.

src-gui/src/renderer/components/pages/swap/swap/SwapWidget.tsx (3)

1-8: LGTM: Clean import additions

The new imports are properly organized and include the necessary MUI Skeleton component and React hooks for the enhanced functionality.


25-30: LGTM: Clear boolean state derivations

The isWaitingForBtcDeposit and isSelectedSwapOffer boolean constants clearly derive UI state from Redux, making the conditional logic more readable.


56-58: LGTM: Appropriate loading state

Using Skeleton component when swap.state is null provides good UX feedback while the swap is initializing.

src-gui/src/renderer/components/pages/swap/swap/SwapStatePage.tsx (5)

2-3: LGTM: Proper Redux hook imports

The Redux hooks useAppDispatch and useAppSelector are correctly imported along with the setSelectedOfferPeerId action.


31-32: LGTM: Clean Redux state selection

The Redux state selection for selectedOfferPeerId follows the proper pattern and uses typed selectors.


34-41: LGTM: Well-structured conditional rendering

The early return pattern for rendering AddressInputPage when an offer is selected is clean and provides both the selected peer ID and a setter function for state management.


53-58: LGTM: Proper callback integration

The onSelectOffer callback correctly dispatches the setSelectedOfferPeerId action, integrating the offer selection with Redux state management.


27-27: LGTM: Component import update

The change from InitPage to AddressInputPage reflects the component's refactored functionality for handling address input after offer selection.

src-gui/src/renderer/components/pages/swap/swap/init/deposit_and_choose_offer/MakerOfferItem.tsx (2)

14-18: LGTM! Clean separation of concerns.

The refactoring successfully lifts the offer selection logic to higher-level components by introducing the onSelectOffer callback. This improves component reusability and centralizes state management.


110-127: Well-implemented user feedback with proper accessibility.

The Tooltip and Button implementation provides clear user feedback when insufficient Bitcoin is available, and the span wrapper ensures the tooltip works correctly with the disabled button.

src-gui/src/renderer/components/pages/swap/swap/init/AddressInputPage.tsx (4)

10-16: Good component renaming and prop interface.

The component rename from InitPage to AddressInputPage better reflects its purpose, and the new props clearly define the selected offer state management.


17-20: Proper integration with Redux state management.

The use of usePendingSelectMakerApproval hook and finding the selected offer by peer_id correctly integrates with the new state management flow.


36-45: Correct refactoring to new approval flow.

The function rename to confirmOffer and the call to resolveSelectMakerApproval properly align with the new architecture where offer confirmation is separated from the initial buy request. Clearing the selection after confirmation is the correct behavior.


131-135: Appropriate button text update.

The button text change from "Continue" to "Confirm" better reflects the new action being performed - confirming a selected offer rather than continuing to the next step.

src-gui/src/renderer/rpc.ts (2)

199-216: Excellent simplification of buyXmr function.

The function is now focused solely on initiating the buy request without address concerns, which aligns perfectly with the new architecture where address handling is deferred until after approval.


218-254: Well-implemented approval resolution function.

The resolveSelectMakerApproval function correctly constructs the Monero receive pool with donation split logic and properly integrates with the backend API through the SelectOfferApprovalRequest type.

swap/src/cli/api/request.rs (7)

961-969: Good refactoring of determine_btc_to_swap return values.

The function now returns the Bitcoin change address and Monero receive pool as part of its result tuple, properly integrating with the new approval flow architecture.


1025-1027: Correct update to approval callback signature.

The callback now returns Option<SelectOfferApprovalRequest> instead of a simple boolean, allowing it to provide rich address data when the user approves the offer.


1041-1056: Proper Bitcoin change address handling with fallback.

The logic correctly handles both external change addresses and falls back to internal wallet addresses when none is provided. The network validation and logging are appropriate.


1650-1654: Correct function signature update.

The request_approval parameter signature is properly updated to match the new approval flow that returns rich approval data instead of a simple boolean.


1661-1663: Proper return type updates.

The function return type is correctly updated to include the optional Bitcoin change address and Monero address pool, maintaining type safety throughout the refactoring.


1749-1774: Well-structured approval response handling.

The approval response handling correctly unwraps the SelectOfferApprovalRequest to extract the Bitcoin change address and Monero receive pool, with proper error handling for rejected or failed approvals.


1819-1841: Consistent return value structure.

The final return statement correctly includes all the new fields (Bitcoin change address and Monero receive pool) that were added to the function signature, maintaining consistency throughout the refactor.

@binarybaron
Copy link
Copy Markdown

We shouldn't save the peer id instead we should, split it into two approval requests:

  1. SelectOffer to select a Peer ID ("Select") button. Once selected we won't request any more quotes because determine_btc_to_swap is finished
  2. SpecifyRedeemRefund which is emitted after determine_btc_to_swap has finished and requests the user to select a Monero address and a Bitcoin refund policy.

This way we won't need any global state.

@binarybaron binarybaron changed the title refactor(swap): Prepare backend to send bitcoin change address and mo… refactor(swap): Enter Redeem / Refund Address After Quote Selection Jul 28, 2025
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
src-gui/src/renderer/components/pages/swap/swap/init/AddressInputPage.tsx (1)

16-18: Well-structured refactoring to support the new approval flow.

The component has been successfully refactored to handle the SpecifyRedeemRefund approval request. The logic for constructing the address pool with donation support is clear and correct. The early return check for specifyRedeemRefundApproval properly prevents undefined access issues.

Also applies to: 34-67

🧹 Nitpick comments (1)
src-gui/src/renderer/components/pages/swap/swap/init/AddressInputPage.tsx (1)

12-14: Consider moving donation addresses to configuration.

While the hardcoded donation addresses work, consider moving them to a configuration file for better maintainability and easier updates.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f012601 and 293863a.

📒 Files selected for processing (12)
  • src-gui/src/models/tauriModelExt.ts (4 hunks)
  • src-gui/src/renderer/components/pages/swap/SwapPage.tsx (1 hunks)
  • src-gui/src/renderer/components/pages/swap/swap/SwapStatePage.tsx (1 hunks)
  • src-gui/src/renderer/components/pages/swap/swap/SwapWidget.tsx (2 hunks)
  • src-gui/src/renderer/components/pages/swap/swap/init/AddressInputPage.tsx (3 hunks)
  • src-gui/src/renderer/components/pages/swap/swap/init/deposit_and_choose_offer/DepositAndChooseOfferPage.tsx (1 hunks)
  • src-gui/src/renderer/components/pages/swap/swap/init/deposit_and_choose_offer/MakerOfferItem.tsx (1 hunks)
  • src-gui/src/renderer/rpc.ts (2 hunks)
  • src-gui/src/store/hooks.ts (2 hunks)
  • src-gui/src/utils/sortUtils.ts (2 hunks)
  • swap/src/cli/api/request.rs (2 hunks)
  • swap/src/cli/api/tauri_bindings.rs (8 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src-gui/src/renderer/components/pages/swap/swap/init/deposit_and_choose_offer/DepositAndChooseOfferPage.tsx
🚧 Files skipped from review as they are similar to previous changes (6)
  • src-gui/src/renderer/components/pages/swap/swap/init/deposit_and_choose_offer/MakerOfferItem.tsx
  • src-gui/src/renderer/rpc.ts
  • src-gui/src/renderer/components/pages/swap/swap/SwapWidget.tsx
  • swap/src/cli/api/request.rs
  • src-gui/src/renderer/components/pages/swap/swap/SwapStatePage.tsx
  • swap/src/cli/api/tauri_bindings.rs
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: eigenwallet/core#0
File: monero-sys/CLAUDE.md:0-0
Timestamp: 2025-07-23T20:01:33.031Z
Learning: Applies to monero-sys/src/lib.rs : In src/lib.rs, provide idiomatic Rust interfaces to the C++ code, use wrapper types (WalletManager, Wallet) with safer interfaces, and handle memory management and safety concerns (never expose raw pointers, implement Send and Sync, use Pin for C++ objects requiring stable memory addresses).
Learnt from: CR
PR: eigenwallet/core#0
File: monero-sys/CLAUDE.md:0-0
Timestamp: 2025-07-23T20:01:33.031Z
Learning: Applies to monero-sys/src/lib.rs : Implement proper deref for wrapper types and use the OnceLock pattern to ensure WalletManager is a singleton.
src-gui/src/renderer/components/pages/swap/SwapPage.tsx (1)

Learnt from: CR
PR: eigenwallet/core#0
File: AGENT.md:0-0
Timestamp: 2025-07-23T20:01:42.422Z
Learning: Applies to swap/Cargo.toml : The swap/Cargo.toml file is frequently edited and should be reviewed carefully for dependency and configuration changes

🧬 Code Graph Analysis (1)
src-gui/src/store/hooks.ts (1)
src-gui/src/models/tauriModelExt.ts (4)
  • PendingSelectOfferApprovalRequest (315-317)
  • isPendingSelectOfferApprovalEvent (343-353)
  • PendingSpecifyRedeemRefundApprovalRequest (319-321)
  • isPendingSpecifyRedeemRefundApprovalEvent (355-365)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build (aarch64-apple-darwin, macos-latest)
  • GitHub Check: test (macos-latest)
  • GitHub Check: build (x86_64-apple-darwin, macos-13)
  • GitHub Check: Cursor Bugbot
🔇 Additional comments (5)
src-gui/src/store/hooks.ts (1)

13-16: LGTM! Hooks follow established patterns.

The new hooks usePendingSelectOfferApproval and usePendingSpecifyRedeemRefundApproval are implemented correctly, following the same pattern as existing approval hooks. They properly utilize the type guards and integrate seamlessly with the Redux store.

Also applies to: 228-236

src-gui/src/utils/sortUtils.ts (1)

3-3: LGTM! Sorting function correctly handles the new approval type.

The sortSelectOfferApprovalsAndKnownQuotes function is well-implemented and follows the established pattern. The difference in spreading (...approval.request.content instead of ...approval.request.content.maker) correctly reflects the different structure of PendingSelectOfferApprovalRequest.

Also applies to: 35-58

src-gui/src/renderer/components/pages/swap/SwapPage.tsx (2)

15-81: Well-implemented auto-suspension logic with proper cleanup.

The implementation correctly handles both navigation and visibility-based suspension with appropriate timer management and cleanup. The 10-second grace period and the check for locked funds provide a good user experience while preventing data loss.


13-13: Consider potential race conditions between timers.

Both effects can potentially set timers simultaneously (e.g., user navigates away while the page is also hidden). While the current implementation should work correctly due to proper cleanup, consider if you need additional logic to prevent multiple timers or to handle edge cases.

Also applies to: 30-37, 60-67

src-gui/src/models/tauriModelExt.ts (1)

9-9: Type definitions and guards correctly implement the new approval flow.

All new types and type guards follow the established patterns in the codebase:

  • PendingSelectOfferApprovalRequest and PendingSpecifyRedeemRefundApprovalRequest properly extend the base approval type
  • Type guards correctly check both the pending state and request type
  • SortableQuoteWithAddress appropriately extends the base quote type for sorting functionality

Also applies to: 315-321, 343-365, 391-394

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@binarybaron binarybaron force-pushed the refactor/later-monero-and-bitcoin-address-step branch from 696ffca to 084fb90 Compare August 28, 2025 14:51
@eigenwallet eigenwallet deleted a comment from coderabbitai bot Aug 28, 2025
@binarybaron
Copy link
Copy Markdown

binarybaron commented Aug 28, 2025

We have to

  • Test this a bit more manually
  • Refactor the frontend code. I didn't do a very good job here.
  • Get the CLI working again
  • Stop fetch-balance-fetch-quotes loop once the user exits the page for a while

@binarybaron binarybaron changed the title refactor(swap): Enter Redeem / Refund Address After Quote Selection refactor(swap): Move redeem/refund input page to the end Aug 28, 2025
@binarybaron binarybaron changed the title refactor(swap): Move redeem/refund input page to the end refactor(swap, gui): Move redeem/refund input page to the end Aug 28, 2025
@binarybaron binarybaron force-pushed the refactor/later-monero-and-bitcoin-address-step branch from e58cf0b to 8b2b28d Compare September 28, 2025 11:26
cursor[bot]

This comment was marked as outdated.

@binarybaron
Copy link
Copy Markdown

@Einliterflasche Do you think this is even necessary?

Just moving the "where to redeem xmr to" / "where to refund bitcoin to" to the setting and defaulting to internal would be a lot easier actually...

@Einliterflasche
Copy link
Copy Markdown

@Einliterflasche Do you think this is even necessary?

Just moving the "where to redeem xmr to" / "where to refund bitcoin to" to the setting and defaulting to internal would be a lot easier actually...

You're right, let's do that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move monero redeem address and bitcoin refund address input to a later step

3 participants