Repository navigation
feat: Maya select destination coin (Requirement 1) - #755
Conversation
Implement coin selection screen for Maya Protocol integration. Users can browse and search Maya-supported cryptocurrencies with live fiat prices fetched from Midgard API, with halted chain indicators. - Add MayaCryptoCurrency model with 19 hardcoded coins - Add MayaEndpoint (Moya) + MayaAPIService for pools and inbound addresses - Add SelectCoinView with search, loading, error, and halted toast states - Add CoinRowView with icon, name, ticker, and fiat price - Wire "Convert Dash" button in MayaPortalView to push coin selection - Bundle 15 coin icon PNGs from crypto-icons inventory - Add all files to both dashwallet and dashpay Xcode targets Co-Authored-By: Claude Opus 4.6 <[email protected]>
📝 WalkthroughWalkthroughAdds Maya Protocol integration: new data models, API client, asset catalog entries, and a SwiftUI-based Maya portal flow with coin selection. Buy/Sell portal is refactored to host SwiftUI and include Maya; new view controllers bridge SwiftUI/UIViewController navigation. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant MayaPortalVC as MayaPortalViewController
participant SelectCoinView as SelectCoinView
participant SelectCoinVM as SelectCoinViewModel
participant MayaService as MayaAPIService
participant MayaAPI as Maya API
User->>MayaPortalVC: Tap "Convert Dash"
MayaPortalVC->>SelectCoinView: Present SelectCoinView (hosting controller)
SelectCoinView->>SelectCoinVM: Task -> loadCoins()
SelectCoinVM->>MayaService: fetchPools()
MayaService->>MayaAPI: GET /pools
MayaAPI-->>MayaService: pools JSON
SelectCoinVM->>MayaService: fetchInboundAddresses()
MayaService->>MayaAPI: GET /inbound_addresses
MayaAPI-->>MayaService: inbound addresses JSON
SelectCoinVM->>SelectCoinVM: Merge data, compute fiat prices
SelectCoinVM-->>SelectCoinView: Publish coins
User->>SelectCoinView: Select coin
SelectCoinView->>MayaPortalVC: onCoinSelected callback
MayaPortalVC->>MayaPortalVC: Navigate to next screen (address entry)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 12
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
DashWallet/Sources/UI/Coinbase/ServiceOverview/ServiceEntryPointModel.swift (1)
74-99:⚠️ Potential issue | 🟡 MinorAvoid empty entry text for
.mayain overview metadata.Line 79 and Line 97 return empty strings, so any Maya usage of this screen will render without a title/CTA label.
Suggested fix
var entryTitle: String { switch self { case .coinbase: return NSLocalizedString("Link your Coinbase account", comment: "Dash Service Overview") case .uphold: return NSLocalizedString("Link your Uphold account", comment: "Dash Service Overview") case .topper: return "" - case .maya: return "" + case .maya: return NSLocalizedString("Swap Dash with Maya", comment: "Dash Service Overview") } } ... var serviceButtonTitle: String { switch self { case .coinbase: return NSLocalizedString("Link Coinbase Account", comment: "Dash Service Overview") case .uphold: return NSLocalizedString("Link Uphold account", comment: "Dash Service Overview") case .topper: return "" - case .maya: return "" + case .maya: return NSLocalizedString("Continue", comment: "Dash Service Overview") } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@DashWallet/Sources/UI/Coinbase/ServiceOverview/ServiceEntryPointModel.swift` around lines 74 - 99, The .maya (and optionally .topper) cases in ServiceEntryPointModel are returning empty strings for entryTitle and serviceButtonTitle causing missing title/CTA; update the entryTitle and serviceButtonTitle switch arms for .maya (and .topper if applicable) to return appropriate localized strings via NSLocalizedString (e.g., NSLocalizedString("Link your Maya account", comment: "Dash Service Overview") and NSLocalizedString("Link Maya Account", comment: "Dash Service Overview")) so the UI shows a proper title and button label; locate the methods entryTitle and serviceButtonTitle in ServiceEntryPointModel to make this change.DashWallet/Sources/UI/Buy Sell/BuySellPortalViewController.swift (1)
250-252:⚠️ Potential issue | 🟠 MajorAdd timeout and nil fallback to placemark await to prevent indefinite hangs.
If
CLGeocoderfails to reverse geocode (network error, invalid location, no results),currentPlacemarknever updates andnextEmittedPlacemark()stalls indefinitely. Add a timeout with safe fallback: treat missing placemark as geoblocked.Suggested fix
- private func isGeoblocked() async -> Bool { + private func isGeoblocked() async -> Bool { let locationManager = DWLocationManager.shared if let placemark = locationManager.currentPlacemark { return geoblockedCountries.contains(placemark.isoCountryCode ?? "") } else if locationManager.currentLocation != nil { - let placemark = await nextEmittedPlacemark() - return geoblockedCountries.contains(placemark.isoCountryCode ?? "") + guard let placemark = await nextEmittedPlacemark(timeoutNanoseconds: 5_000_000_000) else { + return true + } + return geoblockedCountries.contains(placemark.isoCountryCode ?? "") } else { return true } } - private func nextEmittedPlacemark() async -> CLPlacemark { - return await withCheckedContinuation { continuation in - var cancellable: AnyCancellable? - cancellable = DWLocationManager.shared.$currentPlacemark - .compactMap { $0 } - .sink { placemark in - continuation.resume(returning: placemark) - cancellable?.cancel() - } - } + private func nextEmittedPlacemark(timeoutNanoseconds: UInt64) async -> CLPlacemark? { + await withTaskGroup(of: CLPlacemark?.self) { group in + group.addTask { + await withCheckedContinuation { continuation in + var cancellable: AnyCancellable? + cancellable = DWLocationManager.shared.$currentPlacemark + .compactMap { $0 } + .sink { placemark in + continuation.resume(returning: placemark) + cancellable?.cancel() + } + } + } + group.addTask { + try? await Task.sleep(nanoseconds: timeoutNanoseconds) + return nil + } + let result = await group.next() ?? nil + group.cancelAll() + return result + } + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@DashWallet/Sources/UI/Buy` Sell/BuySellPortalViewController.swift around lines 250 - 252, Replace the direct await of nextEmittedPlacemark() with an await that enforces a timeout and a nil-safe fallback: start a Task to await nextEmittedPlacemark(), race it against a Task.sleep timeout (e.g., a few seconds) and cancel the placemark task if the timeout elapses; if the timed task returns nil or times out, treat the result as geoblocked and return true. Update the code around nextEmittedPlacemark(), placemark.isoCountryCode and geoblockedCountries to use this timed result so a missing/failed reverse-geocode will not hang but will default to geoblocked.
🧹 Nitpick comments (6)
DashWallet/Sources/UI/Buy Sell/BuySellPortalView.swift (1)
62-108: Consider extracting a reusable card style modifier.The three service cards repeat the same container styling; pulling that into a small modifier/helper would reduce drift and simplify future tuning.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@DashWallet/Sources/UI/Buy` Sell/BuySellPortalView.swift around lines 62 - 108, The three VStack cards repeat identical container styling; create a reusable ViewModifier (e.g., ServiceCardStyle) or a View extension (.serviceCard()) that applies padding(6), background(Color.secondaryBackground), cornerRadius(12) and shadow(color: .shadow, radius: 10, x: 0, y: 5) and then replace the duplicated modifiers on each VStack that wraps serviceRow (the cards containing serviceRow with icons and the Uphold HStack and the Maya VStack) by applying that modifier instead; ensure the modifier is declared near the BuySellPortalView so it can be used as VStack(...).serviceCard() or .modifier(ServiceCardStyle()) to keep serviceRow, onTopper and onMaya unchanged.DashWallet/Sources/Models/Maya/MayaAPIService.swift (1)
22-31: Add a protocol abstraction for the Maya API service.
MayaAPIService.sharedis fine for wiring, but exposing only a concrete singleton makes ViewModel-level testing and substitution harder. Please expose a protocol and inject that protocol type.Suggested refactor
+protocol MayaAPIServiceProtocol { + func fetchPools() async throws -> [MayaPool] + func fetchInboundAddresses() async throws -> [MayaInboundAddress] +} + -final class MayaAPIService: HTTPClient<MayaEndpoint> { +final class MayaAPIService: HTTPClient<MayaEndpoint>, MayaAPIServiceProtocol { static let shared = MayaAPIService()As per coding guidelines, "Use protocol-based design with extensive use of protocols for dependency injection."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@DashWallet/Sources/Models/Maya/MayaAPIService.swift` around lines 22 - 31, Introduce a protocol (e.g., MayaAPIServiceType) that declares the async methods fetchPools() and fetchInboundAddresses() returning the same types as the concrete class, then make MayaAPIService conform to that protocol; keep the concrete singleton but expose it as the protocol for injection (e.g., change consumers to accept MayaAPIServiceType rather than MayaAPIService and provide MayaAPIService.shared where wiring occurs). Ensure the class signature (final class MayaAPIService: HTTPClient<MayaEndpoint>) remains and that the method signatures for fetchPools() and fetchInboundAddresses() exactly match the protocol so tests can inject mocks implementing MayaAPIServiceType.DashWallet/Sources/UI/Maya/MayaPortalViewController.swift (1)
53-55: Make selection logging debug-scoped and emoji-prefixed.The selection log is unconditional and not using the project’s emoji debug prefix convention.
Suggested fix
let selectCoinVC = SelectCoinHostingController() selectCoinVC.onCoinSelected = { [weak self] coin in - DSLogger.log("Maya: Selected coin \(coin.code) (\(coin.name))") + `#if` DEBUG + DSLogger.log("🎯 Maya: Selected coin \(coin.code) (\(coin.name))") + `#endif` // TODO: Navigate to Enter Destination Address (Requirement 2) }As per coding guidelines, "Wrap debug print statements in
#ifDEBUG blocks or use conditional compilation to prevent performance impact from excessive logging." and "Use emoji debug markers for easy log filtering: 🎯 🌐 💾 🎨 🔍 📍 🗺️."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@DashWallet/Sources/UI/Maya/MayaPortalViewController.swift` around lines 53 - 55, Wrap the unconditional DSLogger.log call inside a DEBUG-only conditional and add the required emoji debug prefix; in other words, locate the closure assigned to selectCoinVC.onCoinSelected in MayaPortalViewController and replace the unconditional DSLogger.log("Maya: Selected coin...") with a debug-only log (e.g., inside `#if` DEBUG ... `#endif`) that prefixes the message with an emoji marker such as "🎯" (e.g., "🎯 Maya: Selected coin \(coin.code) (\(coin.name))") so the message is emitted only in debug builds and follows the project's emoji convention.MAYA.md (3)
99-110: Specify a language for the fenced code block.Line 99 opens a fence without a language (
MD040). Usetext(orbash) to keep lint green.Suggested markdown fix
-``` +```text DashWallet/Sources/Models/Maya/ ├── MayaCryptoCurrency.swift # Coin definitions, hardcoded list, asset notation ├── MayaPool.swift # Pool API response model (asset, price, status) └── MayaAPIService.swift # Network layer for Maya endpoints @@ ├── CoinRowView.swift # Reusable coin row component (normal + halted states) └── SelectCoinHostingController.swift # Thin UIKit wrapper for navigation</details> <details> <summary>🤖 Prompt for AI Agents</summary>Verify each finding against the current code and only fix it if needed.
In
@MAYA.mdaround lines 99 - 110, The fenced code block in the Maya.md
directory listing is missing a language hint (MD040); update the opening fence
fromto a language token liketext (orbash) and ensure the closing fence remainsso the block is properly recognized; locate the directory
listing block under the Maya.md section that contains the DashWallet/Sources/...
tree and change its fence accordingly.</details> --- `21-27`: **Add blank lines around the API endpoints table.** Line 21 starts a table without surrounding blank lines, which violates markdownlint `MD058` and can render inconsistently. <details> <summary>Suggested markdown fix</summary> ```diff ### Endpoints + | Endpoint | Base | Purpose | |----------|------|---------| | `GET /pools` | Midgard | List pools with USD prices and status | | `GET /inbound_addresses` | MayaNode | Vault addresses, halted chain status | | `GET /quote/swap?from_asset=DASH.DASH&to_asset={asset}&amount={sats}&destination={addr}` | MayaNode | Get swap quote with fees and expected output | | `GET /tx/{txid}` | MayaNode | Track swap transaction status | + ``` </details> <details> <summary>🤖 Prompt for AI Agents</summary> ``` Verify each finding against the current code and only fix it if needed. In `@MAYA.md` around lines 21 - 27, The table starting with the header "| Endpoint | Base | Purpose |" in MAYA.md needs blank lines before and after it to satisfy markdownlint MD058; edit MAYA.md to insert one empty line immediately above that header row and one empty line immediately below the table (after the last "| `GET /tx/{txid}` | MayaNode | Track swap transaction status |" row), then re-run linting to confirm MD058 is resolved. ``` </details> --- `306-314`: **Specify a language for the navigation flow fenced block.** Line 306 opens another unlabeled fence (`MD040`). Mark it as `text` for consistency. <details> <summary>Suggested markdown fix</summary> ```diff -``` +```text Buy & Sell Portal → MayaPortalView ("Convert Dash" button) → SelectCoinView (coin picker) ← Req 1 → EnterDestinationAddressView ← Req 2 + 3 + 4 → EnterAmountView ← Req 5 → OrderPreviewView ← Req 6 → TransactionResultView ← Req 7 ``` ``` </details> <details> <summary>🤖 Prompt for AI Agents</summary>Verify each finding against the current code and only fix it if needed.
In
@MAYA.mdaround lines 306 - 314, The fenced block showing the navigation flow
(starting with "Buy & Sell Portal" and containing MayaPortalView,
SelectCoinView, EnterDestinationAddressView, EnterAmountView, OrderPreviewView,
TransactionResultView) must include a language label to satisfy MD040; update
the opening fence totext so the block is explicitly marked as plain text (i.e., change the unlabeledto ```text) to ensure consistent linting and
rendering.</details> </blockquote></details> </blockquote></details> <details> <summary>🤖 Prompt for all review comments with AI agents</summary>Verify each finding against the current code and only fix it if needed.
Inline comments:
In@DashWallet/Sources/Models/Maya/MayaEndpoint.swift:
- Around line 29-35: Replace the force-unwrapped URL initializers in the
MayaEndpoint.baseURL computed property: for cases .getPools and
.getInboundAddresses, perform guarded URL construction (guard let url =
URL(string: "...") else { preconditionFailure("Invalid base URL literal for
MayaEndpoint.") }) and return the guarded url instead of using !; update
the messages to reference the specific case names (getPools,
getInboundAddresses) so SwiftLint's force_unwrapping rule is satisfied and
compile-time literal errors fail fast.In
@DashWallet/Sources/UI/BuySell/BuySellPortalViewController.swift:
- Around line 108-114: The mayaAction currently instantiates and pushes a UIKit
MayaPortalViewController; replace this with a SwiftUI-first route: remove
creating MayaPortalViewController in mayaAction and either call the app's
navigation coordinator (e.g., coordinator.showMayaPortal() or similar) to
navigate, or push a UIHostingController whose rootView is the new SwiftUI
MayaPortalView (passing any required environmentObjects/state). Update
mayaAction to route via the coordinator or UIHostingController(rootView:
MayaPortalView()) instead of creating a new UIKit view controller (do not add
new UIViewController/Storyboard classes like MayaPortalViewController).In
@DashWallet/Sources/UI/BuySell/Model/ServiceDataProvider.swift:
- Around line 43-44: The comment notes that appending Maya with
items.append(.init(service: .maya, dataProvider: nil)) is undone by the
subsequent sort; modify the flow so Maya is pinned to the end after sorting:
remove or filter out the .maya element before performing the sort (the block
that re-sorts the items) and then append a single .maya item once sorting is
complete (or move the existing append to after the sort). Update references
around the items array and the sort logic so the .maya service remains last
regardless of sort behavior.In
@DashWallet/Sources/UI/Home/HomeViewController+Shortcuts.swift:
- Around line 103-104: The fullscreen modal forces a flow that may have no way
to dismiss at the stack root; instead either avoid forcing .fullScreen on the
presented navigationController or ensure the presented root exposes a guaranteed
close control. Modify the presentation code around
navigationController/modalPresentationStyle to use .automatic (or remove the
assignment) and/or add a guaranteed close affordance in
BuySellPortalViewController (e.g., set navigationItem.leftBarButtonItem to a
close/done UIBarButtonItem in its initializer/viewDidLoad that calls dismiss).
Update the dismissal handler to call dismiss(animated:completion:) so users can
always exit the flow.In
@DashWallet/Sources/UI/Maya/MayaPortalViewController.swift:
- Around line 23-58: MayaPortalViewController creates a new UIKit view
controller and performs direct navigation, violating the SwiftUI + Coordinator
rules; refactor by converting MayaPortalViewController into a SwiftUI view (or
replace usage with the existing MayaPortalView) and remove direct pushes to
navigationController — instead call the app coordinator via
DWAppRootViewController (or the app's Coordinator interface) to handle
navigation when the onConvertDash closure is triggered; specifically replace the
navigateToSelectCoin logic (and SelectCoinHostingController
instantiation/onCoinSelected handling) with a coordinator call (e.g.,
coordinator.showSelectCoin(...) or
DWAppRootViewController.shared.coordinator?.presentSelectCoin(...)) so
navigation is performed by the Coordinator rather than pushing a UIKit
controller directly.In
@DashWallet/Sources/UI/Maya/SelectCoinHostingController.swift:
- Around line 23-52: Remove the new UIKit subclass SelectCoinHostingController
and instead provide a SwiftUI-first entry point: delete the
SelectCoinHostingController class and add a small factory/helper that returns a
UIHostingController wrapping SelectCoinView (e.g., a function
makeSelectCoinHostingController(onCoinSelected:@escaping(MayaCryptoCurrency)
-> Void) -> UIHostingController). Ensure the helper wires up the
SelectCoinView's closure (onCoinSelected) and sets the hosting controller's
background and title as needed so callers can push/present the
UIHostingController directly from existing coordinators/controllers without
introducing a new UIViewController subclass.In
@DashWallet/Sources/UI/Maya/SelectCoinView.swift:
- Around line 83-92: The .disabled(item.isHalted) prevents taps reaching the
Button so halted rows can’t show the toast; remove the .disabled modifier and
let the Button always receive taps, then inside the Button action branch on
item.isHalted — if false call onCoinSelected?(item.coin), if true call your
toast/display handler (e.g., presentHaltedToast or an existing onHaltedTapped
closure). Keep the Button label (CoinRowView) and .buttonStyle(.plain) as-is so
appearance is unchanged.- Around line 118-130: The Button call in SelectCoinView.swift uses
trailing-closure label syntax which triggers the
multiple_closures_with_trailing_closure SwiftLint rule; change the initializer
to use the explicit label: parameter form (i.e. Button(action: { Task { await
viewModel.loadCoins() } }, label: { ... })) so the action closure and the label
closure are not ambiguous; update the Button surrounding the Text("Retry")
styling accordingly while keeping the same Task/await call to
viewModel.loadCoins().In
@DashWallet/Sources/UI/Maya/SelectCoinViewModel.swift:
- Around line 54-55: SelectCoinViewModel currently calls
MayaAPIService.shared.fetchPools and .fetchInboundAddresses (and similarly uses
singletons around line 115) which couples the VM to global singletons; refactor
to accept protocol-backed dependencies via the SelectCoinViewModel initializer
(e.g., define a MayaAPIServiceProtocol with methods fetchPools() and
fetchInboundAddresses(), and a CurrencyConversionProtocol for any currency
conversions), replace direct calls to MayaAPIService.shared and other singletons
with calls to the injected protocol instances (store them as properties on
SelectCoinViewModel), and update usages and tests to pass mocks or stubs
implementing those protocols.- Around line 70-72: The loop over MayaCryptoCurrency.supportedCoins currently
skips a coin when poolsByAsset[coin.mayaAsset] is missing; instead, keep the
coin in the output and set its fiat price to nil/empty. Change the guard that
doesguard let pool = poolsByAsset[coin.mayaAsset] else { continue }to fetch
an optional pool (e.g., let pool = poolsByAsset[coin.mayaAsset]) and only
compute fiatPrice when pool != nil; when pool is nil set the coin row's
fiatPrice to nil/empty. Update the code paths that referencepool(price
calculation logic) to handle the optional and ensure the resulting row for each
entry in MayaCryptoCurrency.supportedCoins is always produced.In
@MAYA.md:
- Line 54: Update Requirement 1 row in MAYA.md (the table row with "Select
Destination Coin" and branchfeat/maya-select-dest-coin) to mark its status as
"Implemented" instead of "In Progress"; also locate and update any other
occurrence referenced as "3-3" to reflect the implemented status so the document
remains the single source of truth and consistent with PR#755.- Around line 254-278: The table in MAYA.md (sourced from Android
MayaCurrencyList) lists 20 destination coins but the PR summary says 19; inspect
the MayaCurrencyList runtime filtering (especially exclusions like DASH) to
determine which entry is actually omitted at runtime (compare table rows such as
BTC, ETH, PEPE, ... RUNE), then either remove the excluded row from the
hardcoded table or update the PR summary/doc text to state 20 coins; ensure the
documentation matches the runtime list and mention the exact excluded symbol (or
lack thereof) in the doc update.
Outside diff comments:
In@DashWallet/Sources/UI/BuySell/BuySellPortalViewController.swift:
- Around line 250-252: Replace the direct await of nextEmittedPlacemark() with
an await that enforces a timeout and a nil-safe fallback: start a Task to await
nextEmittedPlacemark(), race it against a Task.sleep timeout (e.g., a few
seconds) and cancel the placemark task if the timeout elapses; if the timed task
returns nil or times out, treat the result as geoblocked and return true. Update
the code around nextEmittedPlacemark(), placemark.isoCountryCode and
geoblockedCountries to use this timed result so a missing/failed reverse-geocode
will not hang but will default to geoblocked.In
@DashWallet/Sources/UI/Coinbase/ServiceOverview/ServiceEntryPointModel.swift:
- Around line 74-99: The .maya (and optionally .topper) cases in
ServiceEntryPointModel are returning empty strings for entryTitle and
serviceButtonTitle causing missing title/CTA; update the entryTitle and
serviceButtonTitle switch arms for .maya (and .topper if applicable) to return
appropriate localized strings via NSLocalizedString (e.g.,
NSLocalizedString("Link your Maya account", comment: "Dash Service Overview")
and NSLocalizedString("Link Maya Account", comment: "Dash Service Overview")) so
the UI shows a proper title and button label; locate the methods entryTitle and
serviceButtonTitle in ServiceEntryPointModel to make this change.
Nitpick comments:
In@DashWallet/Sources/Models/Maya/MayaAPIService.swift:
- Around line 22-31: Introduce a protocol (e.g., MayaAPIServiceType) that
declares the async methods fetchPools() and fetchInboundAddresses() returning
the same types as the concrete class, then make MayaAPIService conform to that
protocol; keep the concrete singleton but expose it as the protocol for
injection (e.g., change consumers to accept MayaAPIServiceType rather than
MayaAPIService and provide MayaAPIService.shared where wiring occurs). Ensure
the class signature (final class MayaAPIService: HTTPClient)
remains and that the method signatures for fetchPools() and
fetchInboundAddresses() exactly match the protocol so tests can inject mocks
implementing MayaAPIServiceType.In
@DashWallet/Sources/UI/BuySell/BuySellPortalView.swift:
- Around line 62-108: The three VStack cards repeat identical container styling;
create a reusable ViewModifier (e.g., ServiceCardStyle) or a View extension
(.serviceCard()) that applies padding(6), background(Color.secondaryBackground),
cornerRadius(12) and shadow(color: .shadow, radius: 10, x: 0, y: 5) and then
replace the duplicated modifiers on each VStack that wraps serviceRow (the cards
containing serviceRow with icons and the Uphold HStack and the Maya VStack) by
applying that modifier instead; ensure the modifier is declared near the
BuySellPortalView so it can be used as VStack(...).serviceCard() or
.modifier(ServiceCardStyle()) to keep serviceRow, onTopper and onMaya unchanged.In
@DashWallet/Sources/UI/Maya/MayaPortalViewController.swift:
- Around line 53-55: Wrap the unconditional DSLogger.log call inside a
DEBUG-only conditional and add the required emoji debug prefix; in other words,
locate the closure assigned to selectCoinVC.onCoinSelected in
MayaPortalViewController and replace the unconditional DSLogger.log("Maya:
Selected coin...") with a debug-only log (e.g., inside#ifDEBUG ...#endif)
that prefixes the message with an emoji marker such as "🎯" (e.g., "🎯 Maya:
Selected coin (coin.code) ((coin.name))") so the message is emitted only in
debug builds and follows the project's emoji convention.In
@MAYA.md:
- Around line 99-110: The fenced code block in the Maya.md directory listing is
missing a language hint (MD040); update the opening fence fromto a language token liketext (orbash) and ensure the closing fence remainsso the
block is properly recognized; locate the directory listing block under the
Maya.md section that contains the DashWallet/Sources/... tree and change its
fence accordingly.- Around line 21-27: The table starting with the header "| Endpoint | Base |
Purpose |" in MAYA.md needs blank lines before and after it to satisfy
markdownlint MD058; edit MAYA.md to insert one empty line immediately above that
header row and one empty line immediately below the table (after the last "|
GET /tx/{txid}| MayaNode | Track swap transaction status |" row), then re-run
linting to confirm MD058 is resolved.- Around line 306-314: The fenced block showing the navigation flow (starting
with "Buy & Sell Portal" and containing MayaPortalView, SelectCoinView,
EnterDestinationAddressView, EnterAmountView, OrderPreviewView,
TransactionResultView) must include a language label to satisfy MD040; update
the opening fence totext so the block is explicitly marked as plain text (i.e., change the unlabeledto ```text) to ensure consistent linting and
rendering.</details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: defaults **Review profile**: CHILL **Plan**: Pro **Run ID**: `554e657e-d4e7-4247-8498-92fe0ad729ee` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 44625a4599a80b20e7810b42ebbadf8a25d4a189 and e247677d9c44d23fcdad118f3d54f320eb9bee32. </details> <details> <summary>⛔ Files ignored due to path filters (18)</summary> * `DashWallet/Resources/AppAssets.xcassets/convert.crypto.imageset/convert.crypto.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` * `DashWallet/Resources/AppAssets.xcassets/maya.logo.imageset/maya.logo.svg` is excluded by `!**/*.svg` * `DashWallet/Resources/AppAssets.xcassets/portal.maya.imageset/portal.maya.svg` is excluded by `!**/*.svg` </details> <details> <summary>📒 Files selected for processing (37)</summary> * `DashWallet.xcodeproj/project.pbxproj` * `DashWallet/Resources/AppAssets.xcassets/convert.crypto.imageset/Contents.json` * `DashWallet/Resources/AppAssets.xcassets/maya.coin.arb.imageset/Contents.json` * `DashWallet/Resources/AppAssets.xcassets/maya.coin.btc.imageset/Contents.json` * `DashWallet/Resources/AppAssets.xcassets/maya.coin.dai.imageset/Contents.json` * `DashWallet/Resources/AppAssets.xcassets/maya.coin.eth.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/Resources/AppAssets.xcassets/maya.logo.imageset/Contents.json` * `DashWallet/Resources/AppAssets.xcassets/portal.maya.imageset/Contents.json` * `DashWallet/Sources/Models/Maya/MayaAPIService.swift` * `DashWallet/Sources/Models/Maya/MayaCryptoCurrency.swift` * `DashWallet/Sources/Models/Maya/MayaEndpoint.swift` * `DashWallet/Sources/Models/Maya/MayaPool.swift` * `DashWallet/Sources/UI/Buy Sell/BuySellPortalView.swift` * `DashWallet/Sources/UI/Buy Sell/BuySellPortalViewController.swift` * `DashWallet/Sources/UI/Buy Sell/Model/BuySellPortalModel.swift` * `DashWallet/Sources/UI/Buy Sell/Model/ServiceDataProvider.swift` * `DashWallet/Sources/UI/Coinbase/ServiceOverview/ServiceEntryPointModel.swift` * `DashWallet/Sources/UI/Home/HomeViewController+Shortcuts.swift` * `DashWallet/Sources/UI/Home/Views/Shortcuts/ShortcutCustomizeBannerView.swift` * `DashWallet/Sources/UI/Maya/CoinRowView.swift` * `DashWallet/Sources/UI/Maya/MayaPortalView.swift` * `DashWallet/Sources/UI/Maya/MayaPortalViewController.swift` * `DashWallet/Sources/UI/Maya/SelectCoinHostingController.swift` * `DashWallet/Sources/UI/Maya/SelectCoinView.swift` * `DashWallet/Sources/UI/Maya/SelectCoinViewModel.swift` * `MAYA.md` </details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
- Replace force-unwrapped URLs in MayaEndpoint with guard let + preconditionFailure - Pin Maya to end of service list after sorting in ServiceDataProvider - Use explicit label: parameter on Button to satisfy SwiftLint trailing closure rule - Remove halted coin UI/logic (Requirement 8 not yet implemented): remove inbound_addresses API call, halted toast, disabled/greyed coin states - Update MAYA.md: mark Req 1 as Implemented, update Req 2 status, fix coin count Co-Authored-By: Claude Opus 4.6 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (2)
DashWallet/Sources/UI/Maya/SelectCoinViewModel.swift (1)
63-79:⚠️ Potential issue | 🟠 MajorKeep supported coins in the list even when Midgard omits a pool.
The
continueon Line 64 removes the coin from the picker entirely when pricing data is missing. That makes the screen smaller than the hardcoded Maya-supported set and turns a transient API gap into a missing destination option. Keep the row and leavefiatPriceempty instead.Suggested fix
for coin in MayaCryptoCurrency.supportedCoins { - guard let pool = poolsByAsset[coin.mayaAsset] else { continue } + let pool = poolsByAsset[coin.mayaAsset] var priceString: String? - if let priceUSD = pool.priceUSD, priceUSD > 0 { + if let priceUSD = pool?.priceUSD, priceUSD > 0 { let fiatAmount = convertUSDToFiat(usdAmount: priceUSD, fiatCurrency: fiatCurrency) if let fiatAmount { priceString = formatter.string(from: NSNumber(value: fiatAmount)) } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@DashWallet/Sources/UI/Maya/SelectCoinViewModel.swift` around lines 63 - 79, The loop over MayaCryptoCurrency.supportedCoins currently skips coins when poolsByAsset[coin.mayaAsset] is missing; remove the guard/continue behavior so each supported coin still gets appended to items even if pool data is absent, set priceString to nil when pool or positive priceUSD is unavailable, and then append a CoinDisplayItem(id: coin.id, coin: coin, fiatPrice: priceString) as before; reference MayaCryptoCurrency.supportedCoins, poolsByAsset, pool.priceUSD, convertUSDToFiat, formatter and CoinDisplayItem to locate and adjust the logic.MAYA.md (1)
44-46:⚠️ Potential issue | 🟡 MinorUpdate the “Current iOS State” section; it’s now stale.
This still says the Convert Dash action is a no-op and that none of the requirements are implemented, which contradicts Line 54 and the current PR scope. That will confuse QA and follow-up planning.
Suggested fix
### Not Yet Implemented -- "Convert Dash" button action (currently a no-op) -- All 8 requirements below +- Requirements 2-8 below🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@MAYA.md` around lines 44 - 46, Update the "Current iOS State" / "Not Yet Implemented" section in MAYA.md to reflect the PR's actual scope: remove or change the bullet that says the "Convert Dash" button action is a no-op and mark which of the eight listed requirements are now implemented (or link to the implementing commits/PR), and ensure the text aligns with the statement near the top of the file that those items are implemented; specifically edit the "Convert Dash" status and the list of the eight requirements so QA/follow-up planning aren’t misled and the document matches the current behavior described elsewhere in the PR.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@DashWallet/Sources/UI/Maya/SelectCoinViewModel.swift`:
- Around line 68-71: The ViewModel is calling convertUSDToFiat()/convert() (via
CurrencyExchanger) from `@MainActor` which can race with unsynchronized background
writes to CurrencyExchanger’s dictionaries; replace the direct call with an
actor-isolated or synchronized access pattern by either (a) introducing an actor
or synchronized service (e.g., CurrencyRatesProvider actor) that exposes an
async method like getSnapshotRates() or convertUSDToFiatAsync(), and call that
from the ViewModel, or (b) capture a thread-safe snapshot of the needed rates
before converting (e.g., request ratesSnapshot =
CurrencyExchanger.snapshotRates() from a synchronized API) and then use
convertUSDToFiat with that snapshot; update occurrences around convertUSDToFiat
(including the block that sets priceString and the similar code at lines 92–103)
to use the actor/snapshot API to avoid unsynchronized dictionary reads.
In `@MAYA.md`:
- Around line 119-138: The README's Requirement 1 plan incorrectly includes
halted-chain work (fetching /inbound_addresses, tracking halted chains,
rendering halted rows/toasts) that was removed from this PR; update the plan in
MAYA.md to remove any mention of halted-chain behavior from the Requirement 1
steps (references: MayaAPIService.swift, SelectCoinViewModel.swift,
SelectCoinView.swift, CoinRowView.swift) and either move that text to
Requirement 8 or explicitly state that halted-chain handling is out of scope for
Req 1 so the doc matches the code changes.
---
Duplicate comments:
In `@DashWallet/Sources/UI/Maya/SelectCoinViewModel.swift`:
- Around line 63-79: The loop over MayaCryptoCurrency.supportedCoins currently
skips coins when poolsByAsset[coin.mayaAsset] is missing; remove the
guard/continue behavior so each supported coin still gets appended to items even
if pool data is absent, set priceString to nil when pool or positive priceUSD is
unavailable, and then append a CoinDisplayItem(id: coin.id, coin: coin,
fiatPrice: priceString) as before; reference MayaCryptoCurrency.supportedCoins,
poolsByAsset, pool.priceUSD, convertUSDToFiat, formatter and CoinDisplayItem to
locate and adjust the logic.
In `@MAYA.md`:
- Around line 44-46: Update the "Current iOS State" / "Not Yet Implemented"
section in MAYA.md to reflect the PR's actual scope: remove or change the bullet
that says the "Convert Dash" button action is a no-op and mark which of the
eight listed requirements are now implemented (or link to the implementing
commits/PR), and ensure the text aligns with the statement near the top of the
file that those items are implemented; specifically edit the "Convert Dash"
status and the list of the eight requirements so QA/follow-up planning aren’t
misled and the document matches the current behavior described elsewhere in the
PR.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7917d735-8053-4bd6-bd45-876e74032197
📒 Files selected for processing (6)
DashWallet/Sources/Models/Maya/MayaEndpoint.swiftDashWallet/Sources/UI/Buy Sell/Model/ServiceDataProvider.swiftDashWallet/Sources/UI/Maya/CoinRowView.swiftDashWallet/Sources/UI/Maya/SelectCoinView.swiftDashWallet/Sources/UI/Maya/SelectCoinViewModel.swiftMAYA.md
🚧 Files skipped from review as they are similar to previous changes (2)
- DashWallet/Sources/UI/Buy Sell/Model/ServiceDataProvider.swift
- DashWallet/Sources/UI/Maya/CoinRowView.swift
HashEngineering
left a comment
There was a problem hiding this comment.
The base branch is "master` instead of "feat/maya"
feat: Maya select destination coin (Requirement 1)
Summary
Changes
New Files
Models (
Sources/Models/Maya/):MayaCryptoCurrency.swift— 19 hardcoded coin definitions with Maya asset notationMayaPool.swift— Decodable model for Midgard/v2/poolsresponseMayaEndpoint.swift— Moya TargetType for Maya API endpointsMayaAPIService.swift— HTTPClient singleton for pools and inbound addressesUI (
Sources/UI/Maya/):SelectCoinView.swift— Search bar, coin list, loading/error/halted statesSelectCoinViewModel.swift— Fetches pools + inbound addresses, USD→fiat conversionCoinRowView.swift— Icon, name, ticker, fiat price (or halted badge)SelectCoinHostingController.swift— UIKit wrapper for navigationAssets: 15 coin icon PNGs from crypto-icons inventory (4 coins share icons across chains)
Modified Files
MayaPortalView.swift— AddedonConvertDashcallback on buttonMayaPortalViewController.swift— Wires navigation to SelectCoinHostingControllerproject.pbxproj— All files added to dashwallet and dashpay targetsTest plan
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
UI Improvements
Assets
Documentation