Skip to content

Conversation

@georgeweiler
Copy link
Contributor

@georgeweiler georgeweiler commented Jan 12, 2026

Explanation

Adds a getTokens method to the ramps-controller. Currently, tokens are fetched in the mobile app via useRampTokens, which duplicates API logic and doesn't persist data. The new method centralizes token fetching in the controller, caches results, and stores tokens in controller state for persistence. This aligns token fetching with other ramps data (countries, eligibility) and prepares for mobile app integration in a follow-up PR.

References

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

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

Adds centralized token fetching and state in the ramps controller.

  • New RampsController.getTokens(region?, action='buy') with request caching; normalizes region for cache keys; uses userRegion when omitted; persists tokens in state
  • init() now fetches user region, eligibility, then prefetches tokens; tokens cleared when userRegion changes or eligibility fetch fails
  • Extends messenger with RampsService:getTokens; adds RampsToken/TokensResponse types and RampsService#getTokens
  • Updates tests extensively for tokens flow, caching, and edge cases; changelog updated

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

@georgeweiler georgeweiler requested a review from a team as a code owner January 12, 2026 22:36
@georgeweiler georgeweiler requested a review from a team as a code owner January 13, 2026 00:02
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