Skip to content

Improve MuSig markets#4631

Merged
HenrikJannsen merged 1 commit intobisq-network:mainfrom
HenrikJannsen:improve-musig-markets
Apr 9, 2026
Merged

Improve MuSig markets#4631
HenrikJannsen merged 1 commit intobisq-network:mainfrom
HenrikJannsen:improve-musig-markets

Conversation

@HenrikJannsen
Copy link
Copy Markdown
Contributor

@HenrikJannsen HenrikJannsen commented Apr 8, 2026

Summary by CodeRabbit

  • New Features

    • Markets reorganized by Market Type (FIAT / OTHER) with dedicated selection items, icons and list entries showing logos and offer counts
    • New market-type enum and menu item components
  • UI/UX Updates

    • Search/filter now targets payment currencies and market display names
    • Dropdown/menu visuals tweaked and dark-grey palette extended
  • Other

    • Last-selected market preferences persisted separately per market type
    • Translation keys updated for market categories

Copilot AI review requested due to automatic review settings April 8, 2026 19:58
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 8, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 73366e27-1bf5-49d7-9311-15149fd9ce1b

📥 Commits

Reviewing files that changed from the base of the PR and between 59cafc9 and 37f41fa.

⛔ Files ignored due to path filters (4)
  • apps/desktop/desktop/src/main/resources/images/markets/fiat-markets.png is excluded by !**/*.png
  • apps/desktop/desktop/src/main/resources/images/markets/fiat-markets@2x.png is excluded by !**/*.png
  • apps/desktop/desktop/src/main/resources/images/markets/other-markets.png is excluded by !**/*.png
  • apps/desktop/desktop/src/main/resources/images/markets/other-markets@2x.png is excluded by !**/*.png
📒 Files selected for processing (28)
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/authorized_role/mediator/mu_sig/components/MuSigMediationCaseDetailSection.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MarketListItem.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MarketTypeListItem.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MuSigCreateOfferDirectionAndMarketController.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MuSigCreateOfferDirectionAndMarketModel.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MuSigCreateOfferDirectionAndMarketView.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MarketType.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MarketsTypeMenuItem.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigMarketItem.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigOfferbookController.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigOfferbookModel.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigOfferbookView.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/SelectableMenuItem.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/SortAndFilterDropdownMenuItem.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/trade/components/MuSigAmountAndPriceDisplay.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/trade/pending/trade_details/MuSigTradeDetailsController.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/trade/pending/trade_state/states/MuSigBaseState.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/trade/pending/trade_state/states/MuSigTradeCompletedTable.java
  • apps/desktop/desktop/src/main/resources/css/base.css
  • apps/desktop/desktop/src/main/resources/css/images.css
  • apps/desktop/desktop/src/main/resources/css/mu_sig.css
  • common/src/main/java/bisq/common/asset/FiatCurrency.java
  • common/src/main/java/bisq/common/market/Market.java
  • i18n/src/main/resources/mu_sig.properties
  • settings/src/main/java/bisq/settings/SettingsService.java
  • settings/src/main/java/bisq/settings/SettingsStore.java
  • settings/src/main/proto/settings.proto

Walkthrough

Refactors MuSig market selection from base-crypto-asset (BTC/XMR) to market-type (FIAT/OTHER); adds MarketType, MarketListItem, MarketTypeListItem and menu item classes; replaces last-selected market map with separate fiat/other settings fields; updates models, controllers, views, resources, and Market APIs to use the “relevant” side.

Changes

Cohort / File(s) Summary
Minor cleanup
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java
Removed an unused java.util.Optional import.
Market type primitives
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MarketType.java, apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MarketTypeListItem.java
Added MarketType enum (FIAT/OTHER) and MarketTypeListItem wrapper with displayName and equality.
Market list item
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MarketListItem.java
New wrapper for Market storing precomputed display strings, offers count string, and a cached/brightened logo Node.
Menu item components
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MarketsTypeMenuItem.java, .../SelectableMenuItem.java, .../SortAndFilterDropdownMenuItem.java
New dropdown/menu item classes providing selectable and sort/filter behaviours, pseudo-class selection styling, and dispose/updateSelection APIs.
Create-offer direction & market
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MuSigCreateOfferDirectionAndMarketController.java, .../MuSigCreateOfferDirectionAndMarketModel.java, .../MuSigCreateOfferDirectionAndMarketView.java
Replaced base-crypto selection with market-type selection: new subscriptions, use of MarketListItem, market-type collections/search, selection persistence, and UI table/view changes; added null-guards for selected market updates.
Offerbook (listing) changes
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigOfferbookController.java, .../MuSigOfferbookModel.java, .../MuSigOfferbookView.java, .../MuSigMarketItem.java
Switched to selectedMarketType; replaced crypto asset menu items with MarketsTypeMenuItems; consolidated icon property to marketsIconId; updated rendering to use market “relevant” fields and removed banned-user service dependency.
Market API updates
common/src/main/java/bisq/common/market/Market.java
Removed old non-BTC helpers; added getRelevantCurrencyCode(), getRelevantCurrencyDisplayName(), and getRelevantCodeAndDisplayName(); updated toString() usage.
Settings API & storage
settings/src/main/java/bisq/settings/SettingsService.java, settings/src/main/java/bisq/settings/SettingsStore.java, settings/src/main/proto/settings.proto
Replaced muSig last-selected market map with two dedicated fiat/other fields/observables and corresponding setters/getters; updated proto, (de)serialization, and persistence wiring.
UI text, images, and CSS
apps/desktop/desktop/src/main/resources/css/base.css, .../images.css, .../mu_sig.css, i18n/src/main/resources/mu_sig.properties
Added -bisq-dark-grey-25; added #fiat-markets/#other-markets images; adjusted dropdown hover styling; replaced crypto-specific i18n keys with market-type keys.
Other UI updates
multiple apps/desktop/desktop/src/main/java/.../MuSig*.java (trade/pending, mediation components)
Replaced uses of getNonBtcCurrencyCode()/Name() with getRelevantCurrencyCode()/DisplayName() across various MuSig views and models.
FiatCurrency simplification
common/src/main/java/bisq/common/asset/FiatCurrency.java
Removed transient cached displayName; getDisplayName() now computes the locale-specific display name on each call.

Sequence Diagram

sequenceDiagram
    participant User as User
    participant View as MuSigOfferbookView
    participant Controller as MuSigOfferbookController
    participant Model as MuSigOfferbookModel
    participant Repo as MarketRepository
    participant Settings as SettingsService

    User->>View: Click market type (FIAT/OTHER)
    View->>Controller: onSelectMarketType(MarketType)
    Controller->>Model: selectedMarketType.set(type)
    Controller->>Repo: getAllFiatMarkets() or getAllCryptoAssetMarkets()
    Repo-->>Controller: List<Market>
    Controller->>Model: update marketListItems (MarketListItem)
    Controller->>Settings: getMuSigLastSelectedFiatMarket()/getMuSigLastSelectedOtherMarket()
    Settings-->>Controller: Market (maybe null)
    Controller->>Model: selectedMarketItem.set(market)
    Model-->>View: observable updates (market items, selection)
    View->>View: render table, highlight MarketsTypeMenuItem

    User->>View: Select specific MarketListItem
    View->>Controller: onMarketListItemClicked(MarketListItem)
    Controller->>Settings: setMuSigLastSelectedFiatMarket()/setMuSigLastSelectedOtherMarket()
    Settings->>Settings: persist()
Loading

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~70 minutes

Possibly related PRs

  • Improve MuSig markets #4631 — Very similar code-level changes replacing base-crypto selection with market-type selection and introducing MarketType/MarketListItem/Settings proto updates.

Poem

🐰 I hopped through code with nimble feet,
I swapped BTC for MARKET-TYPE beat,
FIAT and OTHER now take the seat,
New menus glow and lists repeat,
A tidy hop — refactor complete!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 3.06% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Improve MuSig markets' accurately reflects the primary objective of this changeset, which comprehensively refactors the MuSig market selection and display system.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@HenrikJannsen HenrikJannsen changed the title Use Fiat markets icons and other markets Improve MuSig markets Apr 8, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the MuSig offerbook/create-offer UI to group markets into “Fiat” and “Other” categories with dedicated icons, and persists the last selected market per category.

Changes:

  • Replace base-asset (BTC/XMR) selection with market-type selection (Fiat vs Other) in MuSig offer listing and market selection popup.
  • Add new “fiat-markets” / “other-markets” icons + CSS wiring for desktop UI.
  • Update settings persistence model to store last selected fiat/other market.

Reviewed changes

Copilot reviewed 22 out of 26 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
settings/src/main/proto/settings.proto Reworks persisted settings fields to store last-selected fiat/other market.
settings/src/main/java/bisq/settings/SettingsStore.java Serializes/deserializes new persisted market-type preferences.
settings/src/main/java/bisq/settings/SettingsService.java Exposes new observables and setters for last-selected fiat/other market.
i18n/src/main/resources/mu_sig.properties Adds new i18n keys for “Fiat markets” / “Other markets” and popup label.
common/src/main/java/bisq/common/market/Market.java Adds a display helper used by the new market list UI.
apps/desktop/desktop/src/main/resources/images/markets/other-markets@2x.png Adds new “other markets” icon asset.
apps/desktop/desktop/src/main/resources/images/markets/other-markets.png Adds new “other markets” icon asset.
apps/desktop/desktop/src/main/resources/images/markets/fiat-markets@2x.png Adds new “fiat markets” icon asset.
apps/desktop/desktop/src/main/resources/images/markets/fiat-markets.png Adds new “fiat markets” icon asset.
apps/desktop/desktop/src/main/resources/css/mu_sig.css Tweaks dropdown menu hover/active background styling.
apps/desktop/desktop/src/main/resources/css/images.css Registers new CSS image IDs for fiat/other market icons.
apps/desktop/desktop/src/main/resources/css/base.css Adds a new dark grey color token used by MuSig dropdown styling.
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/SortAndFilterDropdownMenuItem.java Extracts dropdown menu item helper into its own class.
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/SelectableMenuItem.java Extracts selectable dropdown menu item helper into its own class.
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigOfferbookView.java Updates offerbook UI to select market type and show appropriate icons/names.
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigOfferbookModel.java Replaces selected base-asset state with selected market-type state.
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigOfferbookController.java Loads/updates market lists based on market type; persists last selection per type.
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigMarketItem.java Adds “relevant market code/name” logic for fiat vs crypto markets.
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MarketType.java Introduces FIAT/OTHER market type enum with i18n display strings.
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MarketsTypeMenuItem.java Adds a dropdown menu item class specialized for market-type selection.
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MuSigCreateOfferDirectionAndMarketView.java Updates create-offer market selection popup to use market-type table instead of base-asset table.
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MuSigCreateOfferDirectionAndMarketModel.java Adds market-type list state and removes base-asset list state.
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MuSigCreateOfferDirectionAndMarketController.java Drives market list contents based on selected market type; persists last selected by type.
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MarketTypeListItem.java Adds list item wrapper for market types.
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MarketListItem.java Extracts market list item into its own class and uses new Market display helper.
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java Removes unused imports (cleanup).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

🧹 Nitpick comments (2)
common/src/main/java/bisq/common/market/Market.java (1)

160-164: Minor formatting issue and missing trailing newline.

There's an extra space after return on line 162. Also, the file appears to be missing a trailing newline.

✨ Suggested fix
 public String getSignificantCodeAndDisplayName() {
-    return  getNonBtcCurrencyCode() + " (" + getNonBtcCurrencyName() + ")";
+    return getNonBtcCurrencyCode() + " (" + getNonBtcCurrencyName() + ")";
 }
+
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@common/src/main/java/bisq/common/market/Market.java` around lines 160 - 164,
In getSignificantCodeAndDisplayName() remove the stray extra space after the
return keyword so the line reads with correct spacing and formatting, and ensure
the file ends with a trailing newline; this touches the
getSignificantCodeAndDisplayName method only (fix the spacing around "return"
and add a final newline at EOF).
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MarketListItem.java (1)

28-50: Consider whether numOffersAsInteger should be included in equals/hashCode.

Including numOffersAsInteger in equality means that when the offer count changes for a market, the item will be considered different. This could cause the table selection to be lost when the list is refreshed with updated offer counts, as the new item won't equal the previously selected item.

If the intent is to preserve selection across offer count updates, consider excluding numOffersAsInteger from equality:

💡 Alternative: Base equality only on market
 `@EqualsAndHashCode`(onlyExplicitlyIncluded = true)
 `@Getter`
 class MarketListItem {
     `@EqualsAndHashCode.Include`
     private final Market market;
-    `@EqualsAndHashCode.Include`
     private final long numOffersAsInteger;

Otherwise, if offer count changes should trigger visual updates that require re-selection, the current implementation is correct.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MarketListItem.java`
around lines 28 - 50, The current MarketListItem uses
`@EqualsAndHashCode`(onlyExplicitlyIncluded = true) and marks both market and
numOffersAsInteger with `@EqualsAndHashCode.Include`, causing equality to change
when the offer count updates; to preserve selection across updates remove the
`@EqualsAndHashCode.Include` annotation from the numOffersAsInteger field (leave
the market field included) so equality/hashCode are based only on market in the
MarketListItem class (adjust any tests or callers that expect the old semantics
if needed).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MuSigCreateOfferDirectionAndMarketController.java`:
- Around line 166-170: updateWithLastSelectedOrDefaultMarket currently passes
the raw value from
settingsService.getMuSigLastSelectedFiatMarket()/getMuSigLastSelectedOtherMarket()
into setSelectedMarketAndListItem, which can be null and later causes a null
dereference in updateSelectedMarket()/market.isCrypto(); fix by resolving a
non-null, type-appropriate fallback before calling
setSelectedMarketAndListItem—e.g., check Optional presence or use
orElse(defaultMarket) on settingsService.getMuSigLastSelectedFiatMarket() and
getMuSigLastSelectedOtherMarket(), determine a sensible default Market (crypto
vs fiat) and pass that to setSelectedMarketAndListItem; apply the same pattern
to the other occurrence referenced (lines 174–181) so
setSelectedMarketAndListItem always receives a valid Market instance.

In
`@apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigOfferbookController.java`:
- Around line 118-132: The search breaks for OTHER markets because after
selectedBaseCryptoAssetPin switches to
MarketRepository.getAllCryptoAssetMarkets(), the onActivate() search predicate
still filters by quoteCurrencyCode/quoteCurrencyDisplayName (which are BTC for
OTHER markets), excluding altcoins; update the search logic in onActivate() to
use baseCurrencyCode/baseCurrencyDisplayName when model.getSelectedMarketType()
!= MarketType.FIAT (or otherwise include both quote and base fields), so
searches match the visible altcoin columns; adjust references to
quoteCurrencyCode/quoteCurrencyDisplayName to check
baseCurrencyCode/baseCurrencyDisplayName (or both) when
updateMarketItems()/getAllCryptoAssetMarkets() is active.

---

Nitpick comments:
In
`@apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MarketListItem.java`:
- Around line 28-50: The current MarketListItem uses
`@EqualsAndHashCode`(onlyExplicitlyIncluded = true) and marks both market and
numOffersAsInteger with `@EqualsAndHashCode.Include`, causing equality to change
when the offer count updates; to preserve selection across updates remove the
`@EqualsAndHashCode.Include` annotation from the numOffersAsInteger field (leave
the market field included) so equality/hashCode are based only on market in the
MarketListItem class (adjust any tests or callers that expect the old semantics
if needed).

In `@common/src/main/java/bisq/common/market/Market.java`:
- Around line 160-164: In getSignificantCodeAndDisplayName() remove the stray
extra space after the return keyword so the line reads with correct spacing and
formatting, and ensure the file ends with a trailing newline; this touches the
getSignificantCodeAndDisplayName method only (fix the spacing around "return"
and add a final newline at EOF).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 09445b6c-c6f8-4764-b456-3bc3a3770189

📥 Commits

Reviewing files that changed from the base of the PR and between 2b33f88 and 2132b3d.

⛔ Files ignored due to path filters (4)
  • apps/desktop/desktop/src/main/resources/images/markets/fiat-markets.png is excluded by !**/*.png
  • apps/desktop/desktop/src/main/resources/images/markets/fiat-markets@2x.png is excluded by !**/*.png
  • apps/desktop/desktop/src/main/resources/images/markets/other-markets.png is excluded by !**/*.png
  • apps/desktop/desktop/src/main/resources/images/markets/other-markets@2x.png is excluded by !**/*.png
📒 Files selected for processing (22)
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MarketListItem.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MarketTypeListItem.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MuSigCreateOfferDirectionAndMarketController.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MuSigCreateOfferDirectionAndMarketModel.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MuSigCreateOfferDirectionAndMarketView.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MarketType.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MarketsTypeMenuItem.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigMarketItem.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigOfferbookController.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigOfferbookModel.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigOfferbookView.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/SelectableMenuItem.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/SortAndFilterDropdownMenuItem.java
  • apps/desktop/desktop/src/main/resources/css/base.css
  • apps/desktop/desktop/src/main/resources/css/images.css
  • apps/desktop/desktop/src/main/resources/css/mu_sig.css
  • common/src/main/java/bisq/common/market/Market.java
  • i18n/src/main/resources/mu_sig.properties
  • settings/src/main/java/bisq/settings/SettingsService.java
  • settings/src/main/java/bisq/settings/SettingsStore.java
  • settings/src/main/proto/settings.proto
💤 Files with no reviewable changes (1)
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java

@HenrikJannsen HenrikJannsen force-pushed the improve-musig-markets branch from 2132b3d to 59cafc9 Compare April 9, 2026 06:01
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)
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MuSigCreateOfferDirectionAndMarketController.java (1)

166-171: ⚠️ Potential issue | 🟠 Major

Initialize the market type before restoring the persisted market.

The else branch in initializeMarketSelection() skips selectedMarketTypeListItem, so the type subscription never populates the tables on a cold start. If the per-type setting is also empty, updateWithLastSelectedOrDefaultMarket(...) still leaves the screen without any selected market.

Possible fix
     private void updateWithLastSelectedOrDefaultMarket(MarketType marketType) {
-        if (marketType == MarketType.FIAT) {
-            setSelectedMarketAndListItem(settingsService.getMuSigLastSelectedFiatMarket().get());
-        } else {
-            setSelectedMarketAndListItem(settingsService.getMuSigLastSelectedOtherMarket().get());
-        }
+        Market market = marketType == MarketType.FIAT
+                ? settingsService.getMuSigLastSelectedFiatMarket().get()
+                : settingsService.getMuSigLastSelectedOtherMarket().get();
+        if (market == null) {
+            market = model.getMarketListItems().stream()
+                    .map(MarketListItem::getMarket)
+                    .findFirst()
+                    .orElse(null);
+        }
+        setSelectedMarketAndListItem(market);
     }
 
     private void initializeMarketSelection() {
         Market market = settingsService.getSelectedMuSigMarket().get();
         if (market != null) {
             updateSelectedMarket(market);
             if (market.isBtcFiatMarket()) {
                 model.getSelectedMarketTypeListItem().set(new MarketTypeListItem(MarketType.FIAT));
             } else {
                 model.getSelectedMarketTypeListItem().set(new MarketTypeListItem(MarketType.OTHER));
             }
         } else {
-            updateWithLastSelectedOrDefaultMarket(MarketType.FIAT);
+            model.getSelectedMarketTypeListItem().set(new MarketTypeListItem(MarketType.FIAT));
+            updateWithLastSelectedOrDefaultMarket(MarketType.FIAT);
         }
     }

Also applies to: 186-197

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MuSigCreateOfferDirectionAndMarketController.java`
around lines 166 - 171, The code leaves selectedMarketTypeListItem uninitialized
for the non-FIAT branch and also fails to handle empty per-type settings; in
initializeMarketSelection() and where
updateWithLastSelectedOrDefaultMarket(MarketType) is called, ensure
selectedMarketTypeListItem is set for both MarketType.FIAT and the other type
(so the type subscription populates tables on cold start) and change
updateWithLastSelectedOrDefaultMarket to check the Optional returned by
settingsService.getMuSigLastSelectedFiatMarket() /
getMuSigLastSelectedOtherMarket() and, if empty, fall back to the existing
default market selection logic (e.g., call the same default-market resolver used
elsewhere) before calling setSelectedMarketAndListItem; reference
initializeMarketSelection, selectedMarketTypeListItem,
updateWithLastSelectedOrDefaultMarket, setSelectedMarketAndListItem,
settingsService.getMuSigLastSelectedFiatMarket and
settingsService.getMuSigLastSelectedOtherMarket.
🧹 Nitpick comments (1)
apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigMarketItem.java (1)

71-76: Reuse Market’s relevant-side helpers here.

This re-implements the relevant-currency selection rule in the UI model and assumes every crypto market is base-side relevant. Using the Market API directly keeps that rule in one place.

♻️ Suggested simplification
-        if (market.isCrypto()) {
-            relevantMarketCode = market.getBaseCurrencyCode();
-            relevantCurrencyDisplayName = StringUtils.capitalize(market.getBaseCurrencyDisplayName());
-        } else {
-            relevantMarketCode = market.getQuoteCurrencyCode();
-            relevantCurrencyDisplayName = StringUtils.capitalize(market.getQuoteCurrencyDisplayName());
-        }
+        relevantMarketCode = market.getRelevantCurrencyCode();
+        relevantCurrencyDisplayName = StringUtils.capitalize(market.getRelevantCurrencyDisplayName());
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigMarketItem.java`
around lines 71 - 76, Replace the manual branch that inspects market.isCrypto()
and sets relevantMarketCode/relevantCurrencyDisplayName with the Market-provided
helpers; call market.getRelevantCurrencyCode() to populate relevantMarketCode
and market.getRelevantCurrencyDisplayName() (or the equivalent Market helper
methods) to set relevantCurrencyDisplayName inside MuSigMarketItem so the
relevant-side rule stays centralized in Market.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MuSigCreateOfferDirectionAndMarketView.java`:
- Around line 251-255: The cell reuse leaves an old tooltip set when a short
displayString is rendered; in MuSigCreateOfferDirectionAndMarketView (the
rendering/update code that sets label and tooltip), clear the tooltip in the
else branch by calling label.setTooltip(null) (or tooltip.setText("") and then
label.setTooltip(null)) when displayString.length() <= 30 so previously-set
tooltips are removed for short names.

In
`@apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigOfferbookController.java`:
- Around line 417-424: When updating selection in
updateSelectedMuSigMarketWithBaseCurrency(MarketType), handle the case where the
saved fiat/other market is missing or stale: call
findMarketItem(settingsService.getMuSigLastSelectedFiatMarket().get()) (or the
Other variant) and if the Optional is empty, pick a fallback by scanning the
model's market list for the first MarketItem matching MarketType.FIAT or OTHER
(e.g., model.getMarketItems() or model.getMarketItemsForType) and set
model.getSelectedMarketItem() to that; if no matching markets exist, clear or
unset the selectedMarketItem consistently. Ensure you reference findMarketItem,
settingsService.getMuSigLastSelectedFiatMarket()/getMuSigLastSelectedOtherMarket(),
model.getSelectedMarketItem(), and MarketType when implementing.

---

Duplicate comments:
In
`@apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MuSigCreateOfferDirectionAndMarketController.java`:
- Around line 166-171: The code leaves selectedMarketTypeListItem uninitialized
for the non-FIAT branch and also fails to handle empty per-type settings; in
initializeMarketSelection() and where
updateWithLastSelectedOrDefaultMarket(MarketType) is called, ensure
selectedMarketTypeListItem is set for both MarketType.FIAT and the other type
(so the type subscription populates tables on cold start) and change
updateWithLastSelectedOrDefaultMarket to check the Optional returned by
settingsService.getMuSigLastSelectedFiatMarket() /
getMuSigLastSelectedOtherMarket() and, if empty, fall back to the existing
default market selection logic (e.g., call the same default-market resolver used
elsewhere) before calling setSelectedMarketAndListItem; reference
initializeMarketSelection, selectedMarketTypeListItem,
updateWithLastSelectedOrDefaultMarket, setSelectedMarketAndListItem,
settingsService.getMuSigLastSelectedFiatMarket and
settingsService.getMuSigLastSelectedOtherMarket.

---

Nitpick comments:
In
`@apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigMarketItem.java`:
- Around line 71-76: Replace the manual branch that inspects market.isCrypto()
and sets relevantMarketCode/relevantCurrencyDisplayName with the Market-provided
helpers; call market.getRelevantCurrencyCode() to populate relevantMarketCode
and market.getRelevantCurrencyDisplayName() (or the equivalent Market helper
methods) to set relevantCurrencyDisplayName inside MuSigMarketItem so the
relevant-side rule stays centralized in Market.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9ca9fc55-9a2b-4138-a29c-0ad1193adfb0

📥 Commits

Reviewing files that changed from the base of the PR and between 2132b3d and 59cafc9.

⛔ Files ignored due to path filters (4)
  • apps/desktop/desktop/src/main/resources/images/markets/fiat-markets.png is excluded by !**/*.png
  • apps/desktop/desktop/src/main/resources/images/markets/fiat-markets@2x.png is excluded by !**/*.png
  • apps/desktop/desktop/src/main/resources/images/markets/other-markets.png is excluded by !**/*.png
  • apps/desktop/desktop/src/main/resources/images/markets/other-markets@2x.png is excluded by !**/*.png
📒 Files selected for processing (28)
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/authorized_role/mediator/mu_sig/components/MuSigMediationCaseDetailSection.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MarketListItem.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MarketTypeListItem.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MuSigCreateOfferDirectionAndMarketController.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MuSigCreateOfferDirectionAndMarketModel.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MuSigCreateOfferDirectionAndMarketView.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MarketType.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MarketsTypeMenuItem.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigMarketItem.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigOfferbookController.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigOfferbookModel.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigOfferbookView.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/SelectableMenuItem.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/SortAndFilterDropdownMenuItem.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/trade/components/MuSigAmountAndPriceDisplay.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/trade/pending/trade_details/MuSigTradeDetailsController.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/trade/pending/trade_state/states/MuSigBaseState.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/trade/pending/trade_state/states/MuSigTradeCompletedTable.java
  • apps/desktop/desktop/src/main/resources/css/base.css
  • apps/desktop/desktop/src/main/resources/css/images.css
  • apps/desktop/desktop/src/main/resources/css/mu_sig.css
  • common/src/main/java/bisq/common/asset/FiatCurrency.java
  • common/src/main/java/bisq/common/market/Market.java
  • i18n/src/main/resources/mu_sig.properties
  • settings/src/main/java/bisq/settings/SettingsService.java
  • settings/src/main/java/bisq/settings/SettingsStore.java
  • settings/src/main/proto/settings.proto
💤 Files with no reviewable changes (1)
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/bisq_easy/offerbook/BisqEasyOfferbookView.java
✅ Files skipped from review due to trivial changes (7)
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/trade/components/MuSigAmountAndPriceDisplay.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/trade/pending/trade_state/states/MuSigTradeCompletedTable.java
  • apps/desktop/desktop/src/main/resources/css/mu_sig.css
  • apps/desktop/desktop/src/main/resources/css/base.css
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MarketType.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/authorized_role/mediator/mu_sig/components/MuSigMediationCaseDetailSection.java
  • settings/src/main/java/bisq/settings/SettingsService.java
🚧 Files skipped from review as they are similar to previous changes (5)
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/SortAndFilterDropdownMenuItem.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/create_offer/direction_and_market/MarketTypeListItem.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MarketsTypeMenuItem.java
  • apps/desktop/desktop/src/main/java/bisq/desktop/main/content/mu_sig/offer/listing/MuSigOfferbookModel.java
  • common/src/main/java/bisq/common/market/Market.java

@HenrikJannsen HenrikJannsen force-pushed the improve-musig-markets branch from 59cafc9 to 37f41fa Compare April 9, 2026 08:24
@HenrikJannsen HenrikJannsen merged commit 41d8390 into bisq-network:main Apr 9, 2026
13 of 14 checks passed
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.

2 participants