Skip to content

Conversation

@georgeweiler
Copy link
Contributor

@georgeweiler georgeweiler commented Jan 13, 2026

Explanation

The RampsController has no mechanism to store a user's preferred ramp provider. This PR adds preferredProvider state to the RampsController.

  1. Type Definitions: Added Provider, ProviderLink, and ProviderLogos types in RampsService.ts to match the API provider structure
  2. State Management:
    • Added preferredProvider: Provider | null to RampsControllerState
    • Added metadata configuration (persist, includeInDebugSnapshot, includeInStateLogs, usedInUi)
    • Added preferredProvider: null to default state
  3. API: Added setPreferredProvider(provider: Provider | null) method to update the state
  4. Selectors: Added selectPreferredProvider selector in the mobile app for Redux access
  5. Exports: Exported Provider, ProviderLink, and ProviderLogos types from the package index

The implementation follows the exact same pattern as userRegion, ensuring consistency and maintainability.

**Usage:**ript
// Set preferred provider
Engine.context.RampsController.setPreferredProvider(providerObject);

// Get preferred provider
const provider = Engine.context.RampsController.state.preferredProvider;
// Or via selector
const provider = useSelector(selectPreferredProvider);

References

https://consensyssoftware.atlassian.net/browse/TRAM-3150

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Introduces persisted provider preference in the ramps controller state.

  • Adds preferredProvider to RampsController state (persisted, included in debug/state logs, exposed to UI) and defaulted to null
  • Implements setPreferredProvider(provider: Provider | null) to update the state
  • Defines Provider, ProviderLink, and ProviderLogos types in RampsService and exports them via index.ts
  • Updates tests and snapshots for new state; adds unit tests for setPreferredProvider; adjusts selector tests to include preferredProvider
  • Updates CHANGELOG.md to document the addition

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

@georgeweiler georgeweiler requested a review from a team as a code owner January 13, 2026 22:12
@georgeweiler georgeweiler requested a review from a team as a code owner January 13, 2026 22:15
@georgeweiler georgeweiler added this pull request to the merge queue Jan 13, 2026
Merged via the queue into main with commit 13337ec Jan 13, 2026
290 checks passed
@georgeweiler georgeweiler deleted the TRAM-3150-preferred-provider branch January 13, 2026 22:54
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.

3 participants