Skip to content

feat: add Uphold/Coinbase address sources for Maya and fix Coinbase OAuth#759

Merged
bfoss765 merged 1 commit intofeat/mayafrom
feat/maya-coinbase-uphold-address
Mar 23, 2026
Merged

feat: add Uphold/Coinbase address sources for Maya and fix Coinbase OAuth#759
bfoss765 merged 1 commit intofeat/mayafrom
feat/maya-coinbase-uphold-address

Conversation

@bfoss765
Copy link
Copy Markdown
Contributor

@bfoss765 bfoss765 commented Mar 18, 2026

Summary

  • Add Uphold and Coinbase address retrieval to the Maya "Enter Address" screen, allowing users to paste deposit addresses from their exchange accounts
  • Add login flows for both exchanges directly from the address entry screen
  • Fix Coinbase OAuth which migrated to new endpoints (login.coinbase.com/oauth2/auth)
  • Fix token exchange encoding from JSON to application/x-www-form-urlencoded

Changes

Maya Address Sources

  • AddressSourceView: New SwiftUI component showing exchange login state, loading, address, or "not available"
  • MayaExchangeAddressProvider: Fetches deposit addresses from Uphold (card API + network address creation) and Coinbase (direct account lookup + address creation)
  • EnterAddressViewModel: Address source state management with session caching, post-login refresh, and auth expiry detection

Coinbase OAuth Fix (affects entire app)

  • Auth URL: login.coinbase.com/oauth2/auth (was coinbase.com/oauth/authorize)
  • Token URL: login.coinbase.com/oauth2/token (was api.coinbase.com/oauth/token)
  • Redirect URI: dashwallet://brokers/coinbase/connect (was authhub://oauth-callback)
  • Token exchange encoding: application/x-www-form-urlencoded (was JSON)
  • Removed deprecated account and meta[send_limit_*] OAuth parameters

Test plan

  • Open Maya swap flow → select a coin → verify "Enter Address" screen shows Uphold and Coinbase rows
  • Tap Uphold "Log In" → authenticate → verify real crypto address appears (not internal ID)
  • Tap Coinbase "Log In" → authenticate → verify address appears
  • Select BTC, verify both addresses → go back → select ETH, verify both addresses
  • Kill and relaunch app → verify expired sessions show "Log In" (not "Not available")
  • Test Coinbase login from the existing Buy & Sell portal to verify OAuth fix works app-wide

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Added Maya as a service option in the Buy/Sell Portal for cryptocurrency swaps.
    • Expanded cryptocurrency support with additional tokens across multiple blockchain networks (Bitcoin, Ethereum, Arbitrum, and others).
    • Added address management capabilities for Uphold and Coinbase integrations.
    • Introduced QR code scanning for address entry.
  • Updates

    • Updated Coinbase authentication flow and OAuth endpoints.
    • Version bumped to 8.6.0.
    • Enhanced buy/sell portal UI with improved navigation and service selection.

…r Maya swaps

Add exchange address sources to the Maya Enter Address screen so users can
retrieve deposit addresses from their Uphold and Coinbase accounts.

- Add AddressSourceView, MayaExchangeAddressProvider, and address source
  state management to EnterAddressViewModel
- Uphold: fetch cards, create network-specific crypto addresses via API,
  with session caching and proper network key lookup
- Coinbase: direct account lookup by currency code with account-list
  fallback, address creation via POST, session caching
- Add login flows for both exchanges from the Enter Address screen
- Re-check authorization after failed fetches to show "Log In" instead of
  "Not available" when sessions expire

Fix Coinbase OAuth which migrated to new endpoints:
- Auth URL: login.coinbase.com/oauth2/auth (was coinbase.com/oauth/authorize)
- Token URL: login.coinbase.com/oauth2/token (was api.coinbase.com/oauth/token)
- Redirect URI: dashwallet://brokers/coinbase/connect (was authhub://oauth-callback)
- Token exchange encoding: application/x-www-form-urlencoded (was JSON)
- Remove deprecated account and meta[send_limit_*] OAuth parameters

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 18, 2026

Caution

Review failed

Failed to post review comments

📝 Walkthrough

Walkthrough

This PR introduces complete Maya Protocol integration to DashWallet, adding new Swift models (MayaCryptoCurrency, MayaPool, MayaEndpoint), API services, and comprehensive SwiftUI UI components for coin selection and address entry. Coinbase OAuth endpoints are updated to use login.coinbase.com, and the project version is bumped to 8.6.0.

Changes

Cohort / File(s) Summary
Project Configuration
DashWallet.xcodeproj/project.pbxproj
Added file references for 5 new Maya Swift source files; updated MARKETING_VERSION from 8.5.5 to 8.6.0 across all build configurations.
Asset Catalog (Maya Icons & Logos)
DashWallet/Resources/AppAssets.xcassets/Maya/*, DashWallet/Resources/AppAssets.xcassets/maya.coin.*.imageset/Contents.json, DashWallet/Resources/AppAssets.xcassets/convert.crypto.imageset/Contents.json
Added 23 asset catalog metadata files for coin icons (BTC, ETH, ARB, DAI, PEPE, USDC, USDT, WBTC, WSTETH, KUJI, RUNE, LEO, LINK, TGT, GLD) and Maya logos with vector preservation and original template rendering.
Coinbase OAuth & API Endpoints
DashWallet/Sources/Models/Coinbase/Auth/CBAuth.swift, DashWallet/Sources/Models/Coinbase/Infrastructure/API/CoinbaseAPIEndpoint.swift, DashWallet/Sources/Models/Coinbase/Coinbase+Constants.swift
Migrated OAuth2 authorization to login.coinbase.com with updated endpoint paths (/oauth2/*); updated redirect URI and callback scheme from authhub to dashwallet; adjusted token request encoding to URLEncoding.httpBody.
Coinbase Account Service Extensions
DashWallet/Sources/Models/Coinbase/Accounts/AccountRepository.swift, DashWallet/Sources/Models/Coinbase/Accounts/AccountService.swift, DashWallet/Sources/Models/Coinbase/Coinbase.swift
Added allIncludingEmpty() and allAccountsIncludingEmpty() methods to retrieve crypto accounts without balance filtering; exposed account lookup by currency code.
Maya Data Models
DashWallet/Sources/Models/Maya/MayaCryptoCurrency.swift, DashWallet/Sources/Models/Maya/MayaPool.swift, DashWallet/Sources/Models/Maya/MayaEndpoint.swift
Added MayaCryptoCurrency with 20+ supported coins, MayaPool with asset pricing, and MayaEndpoint enum targeting Midgard and MayaNode APIs.
Maya API & Exchange Integration
DashWallet/Sources/Models/Maya/MayaAPIService.swift, DashWallet/Sources/Models/Maya/MayaExchangeAddressProvider.swift
Created MayaAPIService for fetching pools and inbound addresses; implemented MayaExchangeAddressProvider with multi-exchange address sourcing, session caching, and card/address creation logic for Uphold and Coinbase.
Maya Portal UI (Navigation Hub)
DashWallet/Sources/UI/Maya/MayaPortalView.swift, DashWallet/Sources/UI/Maya/MayaPortalViewController.swift
Added SwiftUI MayaPortalView as entry point with "Convert Dash" action; wrapped in UIViewController hosting for integration with existing UIKit navigation stack.
Maya Coin Selection UI
DashWallet/Sources/UI/Maya/SelectCoinView.swift, DashWallet/Sources/UI/Maya/SelectCoinViewModel.swift, DashWallet/Sources/UI/Maya/SelectCoinHostingController.swift, DashWallet/Sources/UI/Maya/CoinRowView.swift
Implemented coin picker with search filtering, fiat price conversion, halted status indicators, error handling with retry, and list sorting logic.
Maya Address Entry UI
DashWallet/Sources/UI/Maya/EnterAddressView.swift, DashWallet/Sources/UI/Maya/EnterAddressViewModel.swift, DashWallet/Sources/UI/Maya/EnterAddressHostingController.swift, DashWallet/Sources/UI/Maya/AddressSourceView.swift
Created address input UI with manual entry, QR scanning, clipboard paste, and Uphold/Coinbase account linking; view model manages source states, authentication checks, and URI normalization.
QR Code Scanning
DashWallet/Sources/UI/Maya/QRCaptureView.swift, DashWallet/Sources/UI/Maya/GenericQRScannerView.swift, DashWallet/Sources/UI/Maya/GenericQRScannerController.swift
Added UIViewRepresentable QR capture bridge with AVCaptureSession, camera authorization, torch control, and metadata delegate; wrapped in generic scanner UI with error handling for unavailable cameras.
Buy/Sell Portal Refactor & Maya Integration
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
Converted UIKit collection view to SwiftUI BuySellPortalView; added maya service case with Maya positioning as trailing card; updated data provider to append Maya last regardless of usage sorting.
Home & UI Polish
DashWallet/Sources/UI/Home/HomeViewController+Shortcuts.swift, DashWallet/Sources/UI/Home/Views/Shortcuts/ShortcutCustomizeBannerView.swift
Set fullScreen presentation style for buy/sell portal; expanded close button hit target with 44x44 frame and accessibility labels.
Documentation
MAYA.md
Added comprehensive integration specification documenting API endpoints, data models, architecture decisions, component implementation details, and acceptance criteria.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant BuySellPortal as BuySellPortalView
    participant MayaPortal as MayaPortalViewController
    participant CoinSelect as SelectCoinViewModel
    participant API as MayaAPIService
    participant AddressEntry as EnterAddressViewModel
    participant ExchangeProvider as MayaExchangeAddressProvider
    participant Uphold as Uphold API
    participant Coinbase as Coinbase API

    User->>BuySellPortal: Tap Maya
    BuySellPortal->>MayaPortal: Navigate to portal
    User->>MayaPortal: Tap Convert Dash
    MayaPortal->>CoinSelect: Show coin selection
    CoinSelect->>API: fetchPools()
    API-->>CoinSelect: Pool data + prices
    User->>CoinSelect: Select coin
    CoinSelect->>AddressEntry: Pass selected coin
    AddressEntry->>ExchangeProvider: loadAddressSources()
    par Load Uphold
        ExchangeProvider->>Uphold: Check auth & fetch addresses
        Uphold-->>ExchangeProvider: Address list or login needed
    and Load Coinbase
        ExchangeProvider->>Coinbase: Check auth & fetch accounts
        Coinbase-->>ExchangeProvider: Address or login needed
    end
    AddressEntry-->>User: Display sources + manual entry
    User->>AddressEntry: Enter/scan address or login
    AddressEntry->>MayaPortal: Confirm address
    MayaPortal-->>User: Complete (navigate to next step)
Loading
sequenceDiagram
    participant User
    participant EnterAddr as EnterAddressView
    participant ViewModel as EnterAddressViewModel
    participant Scanner as GenericQRScannerView
    participant QRCapture as QRCaptureView
    participant AuthSession as ASWebAuthenticationSession
    participant Uphold as Uphold

    User->>EnterAddr: Tap Scan QR
    EnterAddr->>Scanner: Show scanner
    Scanner->>QRCapture: Initialize camera
    QRCapture-->>User: Live preview
    User->>QRCapture: Position QR code
    QRCapture-->>Scanner: QR detected
    Scanner->>ViewModel: onQRCodeScanned(address)
    ViewModel->>EnterAddr: Update address field
    EnterAddr-->>User: Address populated

    alt User taps Login Uphold
        User->>EnterAddr: Tap Uphold login
        EnterAddr->>AuthSession: Open Uphold auth
        AuthSession-->>User: Web authentication
        User->>AuthSession: Authorize
        AuthSession-->>ViewModel: Callback URL
        ViewModel->>EnterAddr: Update uphold state (available)
        EnterAddr-->>User: Address source ready
    end

    User->>EnterAddr: Tap Continue
    EnterAddr->>ViewModel: isAddressValid?
    ViewModel-->>EnterAddr: true
    EnterAddr->>User: Trigger onContinue callback
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Suggested reviewers

  • HashEngineering

Poem

🐰 Maya comes to the wallet, bringing swaps so neat,
QR codes dance and addresses complete,
Uphold and Coinbase now hand in paw,
A hopping new feature, no bugs to gnaw!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% 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 accurately describes the main changes: adding Uphold/Coinbase address sources for Maya and fixing Coinbase OAuth with updated endpoints and encoding.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/maya-coinbase-uphold-address
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

CodeRabbit can use TruffleHog to scan for secrets in your code with verification capabilities.

Add a TruffleHog config file (e.g. trufflehog-config.yml, trufflehog.yml) to your project to customize detectors and scanning behavior. The tool runs only when a config file is present.

@bfoss765 bfoss765 changed the base branch from master to feat/maya March 18, 2026 14:23
Copy link
Copy Markdown
Contributor

@HashEngineering HashEngineering left a comment

Choose a reason for hiding this comment

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

LGTM

@bfoss765 bfoss765 merged commit 97b9709 into feat/maya Mar 23, 2026
4 checks passed
@bfoss765 bfoss765 deleted the feat/maya-coinbase-uphold-address branch March 23, 2026 17:32
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