Skip to content

feat(wallet): dash dex entry point - #782

Merged
romchornyi merged 5 commits into
feat/dash-dexfrom
feat/dash-dex-entry-point
Jun 30, 2026
Merged

romchornyi merged 5 commits into
feat/dash-dexfrom
feat/dash-dex-entry-point

Conversation

@romchornyi

@romchornyi romchornyi commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

Implement DashDEX entry-point with protocol-driven swap provider dispatch to enable proper routing between SwapKit and Maya providers. This ensures correct provider selection at runtime through proper protocol requirements instead of static method dispatch fallbacks.

What was done?

  • Add SwapDirection enum (buy/sell) for directional swap flows
  • Add RouteProvider protocol for swap provider selection logic
  • Implement SwapKit and Maya as SwapProvider conformers via protocol requirements
  • Update SwapBackend to dispatch based on protocol requirements instead of extension-only methods
  • Migrate Maya coin icons from static PNG assets to dynamic loading with fallback UI support
  • Remove static Maya coin asset files (now loaded from API)
  • Add DashDEX entry-point icons and illustrations to asset catalog
  • Update shortcut bar and menu icons for DashDEX feature
  • Enhance swap provider icon URL handling and display
  • Update project configuration and asset references

How Has This Been Tested?

Ran xcodebuild for the dashwallet scheme to verify build integrity
No new Swift compile errors in the DashDEX entry-point and swap provider flow
Verified swap provider selection works correctly between SwapKit and Maya
Confirmed icon loading with fallbacks for missing Maya coin assets
Full build still hits existing repository SwiftLint and TodayExtension linker issues outside this change

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • New Features

    • Added a new Dash DEX shortcut and portal entry from the home screen.
    • Introduced separate Buy Dash and Sell Dash actions with direction-aware coin selection.
    • Improved coin and shortcut visuals with updated icons and artwork.
    • Coin lists now show clearer network/routing labels for supported assets.
  • Bug Fixes

    • Improved icon loading for coins and reduced missing-image fallbacks.
    • Updated swap selection behavior so unsupported buy routes are handled more safely.

…der routing

Implement DashDEX feature entry-point with protocol-driven swap provider dispatch:
- Add SwapDirection enum (buy/sell) for directional swap flows
- Add RouteProvider protocol for swap provider selection logic
- Implement SwapKit and Maya as SwapProvider conformers via protocol requirements
- Update SwapBackend to dispatch based on protocol requirements, not extension fallbacks
- Migrate Maya coin icons to dynamic loading with fallback UI support
- Remove static Maya coin PNG assets (now loaded from API)
- Add DashDEX entry icons and illustrations to asset catalog

This ensures SwapKit overrides work correctly through proper protocol dispatch
instead of being skipped by static method resolution.
Update Maya and Swap UI components with improved icon handling and display:
- Refactor MayaCoinIconLoader for dynamic icon loading with fallback support
- Update MayaCryptoCurrency icon mapping for efficient loading
- Enhance SwapProvider protocol with better icon URL handling
- Update SwapKitModels for improved asset representation
- Optimize SwapKitSwapProvider icon URL construction
- Improve SwapCoinIconView with better fallback UI
- Update SelectCoinViewModel with enhanced icon loading logic
- Refine SwapPortalScaffold UI layout
- Update MayaPortalView for better icon display
- Improve ShortcutAction with DashDEX shortcut icon
- Add shortcut-dash-dex PNG assets to asset catalog
- Update project configuration for asset changes
@coderabbitai

coderabbitai Bot commented Jun 27, 2026 •

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b5ee23a1-da39-43d1-84cd-c3a2c69d471a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds direction-aware Dash DEX swap flow, including new routing and token metadata models, remote coin icon loading from SwapKit logo URLs, updated coin selection presentation, and portal/shortcut wiring for buy and sell actions.

Changes

Dash DEX swap flow

Layer / File(s) Summary
Swap contracts and API
DashWallet/Sources/Models/Swap/*, DashWallet/Sources/Models/SwapKit/*, DashWallet.xcodeproj/project.pbxproj
SwapDirection, RouteProvider, SwapProvider, SwapBackend, and SwapKit token endpoint/model support are added, and the project file wires the new swap sources.
SwapKit classification and logos
DashWallet/Sources/Models/SwapKit/SwapKitSwapProvider.swift
SwapKit pool loading now builds Maya/NEAR classification caches, buy-direction filtering uses that state, and logo URLs come from the identifier map.
Maya coins and remote icon loading
DashWallet/Sources/Models/Maya/MayaCryptoCurrency.swift, DashWallet/Sources/Models/Maya/MayaCoinIconLoader.swift
Maya coin storage moves to remote icon URLs, supported assets and curated coins change, and icon loading uses ordered candidate URLs with cache-by-URL.
Direction-aware coin selection
DashWallet/Sources/UI/Swap/SelectCoin/*
The select-coin controller, view, and view model now pass SwapDirection through, surface network labels and halted state, and load icons from coin.iconURL.
Portal entry and UI wiring
DashWallet/Sources/UI/Home/*, DashWallet/Sources/UI/Maya/MayaPortalView.swift, DashWallet/Sources/UI/Swap/*, DashWallet/Sources/UI/SwapKit/*, DashWallet/Resources/AppAssets.xcassets/*, DashWallet.xcodeproj/project.pbxproj
The Dash DEX shortcut opens the authenticated portal, the scaffold and portal views split buy/sell actions, the swap flow branches by direction, and the new assets and remaining project entries are updated.

Sequence Diagram(s)

sequenceDiagram
  participant "HomeViewController+Shortcuts" as HomeShortcuts
  participant "DSAuthenticationManager" as Auth
  participant "SwapKitPortalViewController" as PortalVC
  participant "SwapFlowCoordinator" as Flow
  participant "SelectCoinHostingController" as Host
  participant "SelectCoinViewModel" as Model
  participant "SwapKitSwapProvider" as Provider
  participant "SwapKitAPIService" as API

  HomeShortcuts->>Auth: authenticate dashDEXAction()
  Auth-->>HomeShortcuts: authenticated
  HomeShortcuts->>PortalVC: present SwapKitPortalViewController
  PortalVC->>Flow: start(direction)
  Flow->>Host: create SelectCoinHostingController(direction)
  Host->>Model: init(swapProvider, direction)
  Model->>Provider: fetchPools(direction)
  Provider->>API: tokens(provider)
  API-->>Provider: token lists
  Provider-->>Model: pools, labels, halted assets, logo URLs
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • dashpay/dashwallet-ios#773: Both PRs touch DashWallet/Sources/UI/Home/Views/Shortcuts/Models/ShortcutAction.swift, where the shortcut action model and icon/title mapping are updated.
  • dashpay/dashwallet-ios#777: Both PRs touch DashWallet/Sources/Models/Maya/MayaCoinIconLoader.swift; this PR refactors the remote icon-loading path that PR #777 originally introduced.

Suggested reviewers

  • HashEngineering

Poem

I hopped to the portal with carrot-tipped cheer,
Saw buy and sell buttons appear bright and clear.
Remote icons came bounding from far-away trees,
And Dash DEX went swishing on soft bunny knees. 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 48.65% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary change: adding a Dash DEX entry point in the wallet.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/dash-dex-entry-point

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.

@romchornyi

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 27, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@romchornyi romchornyi changed the title Feat(wallet): dash dex entry point feat(wallet): dash dex entry point Jun 27, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🧹 Nitpick comments (3)
DashWallet/Sources/UI/Swap/SwapFlowCoordinator.swift (1)

36-36: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Misleading log prefix for the SwapKit flow.

This coordinator is also driven by SwapKitPortalViewController (provider = SwapBackend.swapKit.makeProvider()), so the hardcoded "Maya:" prefix will mislabel SwapKit selections. Consider a provider-agnostic prefix and an emoji marker for log filtering.

♻️ Suggested tweak
-            DSLogger.log("Maya: Selected coin \(coin.code) (\(coin.name)) direction=\(self.direction)")
+            DSLogger.log("🔍 Swap: Selected coin \(coin.code) (\(coin.name)) direction=\(self.direction)")

As per coding guidelines: "Use emoji debug markers for easy log filtering: 🎯 🌐 💾 🎨 🔍 📍 🗺️".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@DashWallet/Sources/UI/Swap/SwapFlowCoordinator.swift` at line 36, The log
message in SwapFlowCoordinator’s coin selection path is hardcoded with the
“Maya:” prefix, which mislabels selections when the coordinator is used by
SwapKit. Update the DSLogger.log call in the coin-selection flow to use a
provider-agnostic message and add one of the approved emoji debug markers for
filtering, keeping the rest of the selection details intact.

Source: Coding guidelines

DashWallet/Sources/Models/SwapKit/SwapKitSwapProvider.swift (2)

372-396: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add DSLogger emoji prefixes.

These new DSLogger messages omit the repo’s required emoji markers for filtering. As per coding guidelines, “Use emoji logging prefixes (🔍 for search, 📍 for location, 🗺️ for map) with DSLogger for easier debugging and log filtering.”

Proposed fix
-                DSLogger.log("SwapKit: classification produced empty token lists — marking unusable")
+                DSLogger.log("🔍 SwapKit: classification produced empty token lists — marking unusable")
@@
-            DSLogger.log("SwapKit: classification built — mayaOnly=\(mayaOnlyAssets.count) nearOnly=\(nearOnlyAssets.count) both=\(bothAssets.count)")
+            DSLogger.log("🔍 SwapKit: classification built — mayaOnly=\(mayaOnlyAssets.count) nearOnly=\(nearOnlyAssets.count) both=\(bothAssets.count)")
         } catch {
             classificationUsable = false
-            DSLogger.log("SwapKit: classification fetch failed: \(error) — Buy will show error state")
+            DSLogger.log("🔍 SwapKit: classification fetch failed: \(error) — Buy will show error state")
         }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@DashWallet/Sources/Models/SwapKit/SwapKitSwapProvider.swift` around lines 372
- 396, The new DSLogger messages in the SwapKit classification flow are missing
the required emoji prefixes for log filtering. Update the logs in the
classification path inside SwapKitSwapProvider’s token classification block,
including the empty-list, successful build, and catch/error cases, to use the
repo’s emoji markers (🔍, 📍, or 🗺️) consistently with the existing DSLogger
conventions.

Source: Coding guidelines


400-402: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Restrict remote icon URLs to HTTP(S).

URL(string:) accepts non-image/non-network schemes; returning nil for non-HTTP(S) lets the UI fall back cleanly instead of passing unsupported token-list data downstream.

Proposed fix
     func logoURL(for mayaAsset: String) -> URL? {
-        guard let s = logoURIByIdentifier[mayaAsset.uppercased()], let url = URL(string: s) else { return nil }
+        guard let s = logoURIByIdentifier[mayaAsset.uppercased()],
+              let url = URL(string: s),
+              let scheme = url.scheme?.lowercased(),
+              ["http", "https"].contains(scheme)
+        else { return nil }
         return url
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@DashWallet/Sources/Models/SwapKit/SwapKitSwapProvider.swift` around lines 400
- 402, Restrict remote icon URLs to HTTP(S) in logoURL(for mayaAsset:) by
validating the parsed URL’s scheme before returning it. Keep the existing lookup
in logoURIByIdentifier, but only return the URL when URL(string:) succeeds and
the scheme is http or https; otherwise return nil so unsupported token-list
values don’t propagate downstream.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@DashWallet.xcodeproj/project.pbxproj`:
- Around line 559-560: The project file contains duplicate
PBXBuildFile/PBXFileReference entries for MayaSwapPendingGate.swift, causing the
same source to be added twice to the Sources phase and Transactions group. In
DashWallet.xcodeproj/project.pbxproj, keep only one reference set for
MayaSwapPendingGate.swift across the relevant target entries and remove the
extra PBXBuildFile/PBXFileReference lines so the file is compiled once per
target.

In
`@DashWallet/Resources/AppAssets.xcassets/Shortcuts/shortcut-bar-dash-dex.imageset/Contents.json`:
- Around line 2-7: The shortcut-bar Dash Dex imageset now references an SVG, but
its Contents.json is missing the required vector metadata. Update the imageset’s
Contents.json for shortcut-bar-dash-dex to include the info/properties block
with preserves-vector-representation and set template-rendering-intent to the
correct value for this asset, using either template or original based on how the
icon should render.

In `@DashWallet/Sources/Models/Maya/MayaCryptoCurrency.swift`:
- Line 36: The stored property in MayaCryptoCurrency is redundantly initialized
to nil, triggering SwiftLint’s implicit_optional_initialization warning. Update
the iconURL declaration to rely on Swift’s default optional initialization while
keeping the memberwise initializer behavior unchanged. Use the
MayaCryptoCurrency property definition as the location to make this cleanup.

In `@DashWallet/Sources/Models/SwapKit/SwapKitSwapProvider.swift`:
- Around line 371-375: The unusable classification path in SwapKitSwapProvider
is leaving stale cached state behind because it only flips classificationUsable
to false while classificationBuilt stays true, so later networkLabels and
haltedAssets reads can reuse outdated data. Update the empty-token and any other
unusable refresh branches to also clear/reset the built classification state and
any derived cached labels/asset lists before returning, using the existing
classificationUsable, classificationBuilt, networkLabels, and haltedAssets flow
as the touchpoints.
- Around line 123-142: The Buy-asset filtering in filteredPools(_:for:) is
currently failing open because it only removes known mayaOnlyAssets, letting
unclassified assets through. Update the SwapKitSwapProvider logic so Buy results
include only assets explicitly classified as nearOnly or both, using the
existing classification data built by buildClassification() and gated by
classificationUsable. Keep the error path in filteredPools(_:for:) unchanged,
but replace the final pools.filter check with a whitelist based on the asset
classification maps/sets rather than a blacklist.

In `@DashWallet/Sources/UI/Swap/SelectCoin/Components/SwapCoinIconView.swift`:
- Around line 51-54: The loading task in SwapCoinIconView should be keyed by the
actual image source instead of coin.mayaAsset, since a changed iconURL for the
same asset must cancel and reload the task. Update the .task identifier in the
SwapCoinIconView body so it tracks coin.iconURL, and keep the existing
reset/load/withAnimation flow in the task closure.

In `@DashWallet/Sources/UI/Swap/SelectCoin/SelectCoinViewModel.swift`:
- Around line 88-90: In SelectCoinViewModel’s pool-loading flow,
fetchPools(direction:) and fetchInboundAddresses() are currently started
together, which can let fetchInboundAddresses() read
SwapKitSwapProvider.cachedPools before it is populated and return an empty list.
Update the async flow so fetchPools(direction:) completes first, then call
fetchInboundAddresses(), and keep the later inboundChains filtering aligned with
the now-populated pools.

In `@DashWallet/Sources/UI/SwapKit/SwapKitPortalView.swift`:
- Line 27: The SwapKitPortalView logo is pointing to a non-existent asset name,
so update the logoIcon configuration to use the existing dash-dex-illustration
asset instead of the current custom("illustration-dash-dex", bundle: .dashUIKit)
reference. Keep the fix local to SwapKitPortalView so the image resolves to the
asset already present in the app resources.

---

Nitpick comments:
In `@DashWallet/Sources/Models/SwapKit/SwapKitSwapProvider.swift`:
- Around line 372-396: The new DSLogger messages in the SwapKit classification
flow are missing the required emoji prefixes for log filtering. Update the logs
in the classification path inside SwapKitSwapProvider’s token classification
block, including the empty-list, successful build, and catch/error cases, to use
the repo’s emoji markers (🔍, 📍, or 🗺️) consistently with the existing
DSLogger conventions.
- Around line 400-402: Restrict remote icon URLs to HTTP(S) in logoURL(for
mayaAsset:) by validating the parsed URL’s scheme before returning it. Keep the
existing lookup in logoURIByIdentifier, but only return the URL when
URL(string:) succeeds and the scheme is http or https; otherwise return nil so
unsupported token-list values don’t propagate downstream.

In `@DashWallet/Sources/UI/Swap/SwapFlowCoordinator.swift`:
- Line 36: The log message in SwapFlowCoordinator’s coin selection path is
hardcoded with the “Maya:” prefix, which mislabels selections when the
coordinator is used by SwapKit. Update the DSLogger.log call in the
coin-selection flow to use a provider-agnostic message and add one of the
approved emoji debug markers for filtering, keeping the rest of the selection
details intact.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9860bf94-9329-4ee6-a707-6f1c3271cdb9

📥 Commits

Reviewing files that changed from the base of the PR and between 9836de1 and 0b07dd2.

⛔ Files ignored due to path filters (22)
  • DashWallet/Resources/AppAssets.xcassets/Shortcuts/shortcut-bar-dash-dex.imageset/shortcut-bar-dash-dex.svg is excluded by !**/*.svg
  • DashWallet/Resources/AppAssets.xcassets/Shortcuts/shortcut-dash-dex.imageset/shortcut-dash-dex.png is excluded by !**/*.png
  • DashWallet/Resources/AppAssets.xcassets/Shortcuts/shortcut-dash-dex.imageset/[email protected] is excluded by !**/*.png
  • DashWallet/Resources/AppAssets.xcassets/Shortcuts/shortcut-dash-dex.imageset/[email protected] is excluded by !**/*.png
  • DashWallet/Resources/AppAssets.xcassets/dash-dex-buy.imageset/dash-dex-buy.svg is excluded by !**/*.svg
  • DashWallet/Resources/AppAssets.xcassets/dash-dex-illustration.imageset/dash-dex-illustration.svg is excluded by !**/*.svg
  • DashWallet/Resources/AppAssets.xcassets/dash-dex-sell.imageset/dash-dex-sell.svg is excluded by !**/*.svg
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.arb.imageset/maya.coin.arb.png is excluded by !**/*.png
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.btc.imageset/maya.coin.btc.png is excluded by !**/*.png
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.dai.imageset/maya.coin.dai.png is excluded by !**/*.png
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.eth.imageset/maya.coin.eth.png is excluded by !**/*.png
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.gld.imageset/maya.coin.gld.png is excluded by !**/*.png
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.kuji.imageset/maya.coin.kuji.png is excluded by !**/*.png
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.leo.imageset/maya.coin.leo.png is excluded by !**/*.png
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.link.imageset/maya.coin.link.png is excluded by !**/*.png
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.pepe.imageset/maya.coin.pepe.png is excluded by !**/*.png
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.rune.imageset/maya.coin.rune.png is excluded by !**/*.png
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.tgt.imageset/maya.coin.tgt.png is excluded by !**/*.png
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.usdc.imageset/maya.coin.usdc.png is excluded by !**/*.png
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.usdt.imageset/maya.coin.usdt.png is excluded by !**/*.png
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.wbtc.imageset/maya.coin.wbtc.png is excluded by !**/*.png
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.wsteth.imageset/maya.coin.wsteth.png is excluded by !**/*.png
📒 Files selected for processing (39)
  • DashWallet.xcodeproj/project.pbxproj
  • DashWallet/Resources/AppAssets.xcassets/Shortcuts/shortcut-bar-dash-dex.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/Shortcuts/shortcut-dash-dex.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/dash-dex-buy.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/dash-dex-illustration.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/dash-dex-sell.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.gld.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.kuji.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.leo.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.link.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.pepe.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.rune.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.tgt.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.usdc.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.usdt.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.wbtc.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.wsteth.imageset/Contents.json
  • DashWallet/Sources/Models/Maya/MayaCoinIconLoader.swift
  • DashWallet/Sources/Models/Maya/MayaCryptoCurrency.swift
  • DashWallet/Sources/Models/Swap/RouteProvider.swift
  • DashWallet/Sources/Models/Swap/SwapBackend.swift
  • DashWallet/Sources/Models/Swap/SwapDirection.swift
  • DashWallet/Sources/Models/Swap/SwapProvider.swift
  • DashWallet/Sources/Models/SwapKit/SwapKitAPIService.swift
  • DashWallet/Sources/Models/SwapKit/SwapKitConstants.swift
  • DashWallet/Sources/Models/SwapKit/SwapKitEndpoint.swift
  • DashWallet/Sources/Models/SwapKit/SwapKitModels.swift
  • DashWallet/Sources/Models/SwapKit/SwapKitSwapProvider.swift
  • DashWallet/Sources/UI/Home/HomeViewController+Shortcuts.swift
  • DashWallet/Sources/UI/Home/Views/Shortcuts/Models/ShortcutAction.swift
  • DashWallet/Sources/UI/Maya/MayaPortalView.swift
  • DashWallet/Sources/UI/Swap/SelectCoin/Components/SwapCoinIconView.swift
  • DashWallet/Sources/UI/Swap/SelectCoin/SelectCoinHostingController.swift
  • DashWallet/Sources/UI/Swap/SelectCoin/SelectCoinView.swift
  • DashWallet/Sources/UI/Swap/SelectCoin/SelectCoinViewModel.swift
  • DashWallet/Sources/UI/Swap/SwapFlowCoordinator.swift
  • DashWallet/Sources/UI/Swap/SwapPortalScaffold.swift
  • DashWallet/Sources/UI/SwapKit/SwapKitPortalView.swift
  • DashWallet/Sources/UI/SwapKit/SwapKitPortalViewController.swift
💤 Files with no reviewable changes (11)
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.usdc.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.gld.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.wsteth.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.wbtc.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.tgt.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.leo.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.link.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.kuji.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.usdt.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.pepe.imageset/Contents.json
  • DashWallet/Resources/AppAssets.xcassets/maya.coin.rune.imageset/Contents.json

Comment thread DashWallet.xcodeproj/project.pbxproj Resolved
/// remote loading in that case.
let iconAssetName: String
/// Remote icon URL string sourced from SwapKit `logoURI`. Nil when not yet loaded or unavailable.
var iconURL: String? = nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Let Swift initialize the optional to nil.

SwiftLint flags this as implicit_optional_initialization; dropping = nil preserves the same memberwise-init behavior.

Proposed fix
-    var iconURL: String? = nil
+    var iconURL: String?

As per coding guidelines, **/*.swift: Use SwiftFormat and SwiftLint for Swift code formatting and linting as configured in .swiftformat and .swiftlint.yml files.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
var iconURL: String? = nil
var iconURL: String?
🧰 Tools
🪛 SwiftLint (0.64.0)

[Warning] 36-36: Optional should be implicitly initialized without nil

(implicit_optional_initialization)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@DashWallet/Sources/Models/Maya/MayaCryptoCurrency.swift` at line 36, The
stored property in MayaCryptoCurrency is redundantly initialized to nil,
triggering SwiftLint’s implicit_optional_initialization warning. Update the
iconURL declaration to rely on Swift’s default optional initialization while
keeping the memberwise initializer behavior unchanged. Use the
MayaCryptoCurrency property definition as the location to make this cleanup.

Sources: Coding guidelines, Linters/SAST tools

Comment on lines +51 to +54
.task(id: coin.mayaAsset) {
remoteImage = nil
guard needsRemoteIcon else { return }

var loaded = await MayaCoinIconLoader.shared.loadSwapKitIcon(for: coin.mayaAsset)
if loaded == nil {
loaded = await MayaCoinIconLoader.shared.loadJsupaIcon(for: coin.code)
}
withAnimation(.easeIn(duration: 0.15)) {
remoteImage = loaded
}
let loaded = await MayaCoinIconLoader.shared.loadIcon(logoURI: coin.iconURL, ticker: coin.code)
withAnimation(.easeIn(duration: 0.15)) { remoteImage = loaded }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Key the loading task by the URL it actually loads.

Line 51 still uses coin.mayaAsset, so a changed iconURL for the same asset will not cancel/reload and can leave a stale icon.

Proposed fix
-        .task(id: coin.mayaAsset) {
+        .task(id: coin.iconURL) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.task(id: coin.mayaAsset) {
remoteImage = nil
guard needsRemoteIcon else { return }
var loaded = await MayaCoinIconLoader.shared.loadSwapKitIcon(for: coin.mayaAsset)
if loaded == nil {
loaded = await MayaCoinIconLoader.shared.loadJsupaIcon(for: coin.code)
}
withAnimation(.easeIn(duration: 0.15)) {
remoteImage = loaded
}
let loaded = await MayaCoinIconLoader.shared.loadIcon(logoURI: coin.iconURL, ticker: coin.code)
withAnimation(.easeIn(duration: 0.15)) { remoteImage = loaded }
.task(id: coin.iconURL) {
remoteImage = nil
let loaded = await MayaCoinIconLoader.shared.loadIcon(logoURI: coin.iconURL, ticker: coin.code)
withAnimation(.easeIn(duration: 0.15)) { remoteImage = loaded }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@DashWallet/Sources/UI/Swap/SelectCoin/Components/SwapCoinIconView.swift`
around lines 51 - 54, The loading task in SwapCoinIconView should be keyed by
the actual image source instead of coin.mayaAsset, since a changed iconURL for
the same asset must cancel and reload the task. Update the .task identifier in
the SwapCoinIconView body so it tracks coin.iconURL, and keep the existing
reset/load/withAnimation flow in the task closure.

Comment on lines 88 to 90
async let poolsRequest = swapProvider.fetchPools(direction: direction)
async let inboundRequest = swapProvider.fetchInboundAddresses()
let (pools, inboundAddresses) = try await (poolsRequest, inboundRequest)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Fetch pools before inbound addresses to avoid empty-list races.

fetchInboundAddresses() depends on SwapKitSwapProvider.cachedPools; running it concurrently with fetchPools(direction:) can hit the empty-cache fallback and return [], after which Line 131 filters out every pool via inboundChains.

Proposed fix
-            async let poolsRequest = swapProvider.fetchPools(direction: direction)
-            async let inboundRequest = swapProvider.fetchInboundAddresses()
-            let (pools, inboundAddresses) = try await (poolsRequest, inboundRequest)
+            let pools = try await swapProvider.fetchPools(direction: direction)
+            let inboundAddresses = try await swapProvider.fetchInboundAddresses()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async let poolsRequest = swapProvider.fetchPools(direction: direction)
async let inboundRequest = swapProvider.fetchInboundAddresses()
let (pools, inboundAddresses) = try await (poolsRequest, inboundRequest)
let pools = try await swapProvider.fetchPools(direction: direction)
let inboundAddresses = try await swapProvider.fetchInboundAddresses()
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@DashWallet/Sources/UI/Swap/SelectCoin/SelectCoinViewModel.swift` around lines
88 - 90, In SelectCoinViewModel’s pool-loading flow, fetchPools(direction:) and
fetchInboundAddresses() are currently started together, which can let
fetchInboundAddresses() read SwapKitSwapProvider.cachedPools before it is
populated and return an empty list. Update the async flow so
fetchPools(direction:) completes first, then call fetchInboundAddresses(), and
keep the later inboundChains filtering aligned with the now-populated pools.

… integration

Improve swap UI components and Maya provider icon loading:
- Enhance MayaCryptoCurrency icon mapping with better fallback support
- Optimize SwapKitSwapProvider icon URL handling
- Improve SwapCoinIconView with better image loading and fallback UI
- Update SelectCoinViewModel with enhanced icon loading logic
- Refine SwapKitPortalView icon display
- Update project configuration

This improves the user experience when displaying swap provider icons and coin assets.
@romchornyi
romchornyi merged commit eb1f650 into feat/dash-dex Jun 30, 2026
1 check passed
aliblik pushed a commit to aliblik/dashwallet-ios that referenced this pull request Nov 28, 2026
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