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 region/action-aware token fetching and persistence to align with other ramps data.

  • New RampsService#getTokens(region, action) and types (RampsToken, TokensResponse), with response validation
  • New RampsController#getTokens(region?, action='buy') using request cache (TTL/dedup), normalizes region, caches per [region, action], and updates state.tokens only when matching current userRegion
  • Controller state expanded with tokens (persisted, exposed in metadata); setUserRegion/updateUserRegion now clear tokens on change and on eligibility fetch failures
  • init() now fetches userRegion + eligibility, then getTokens('buy'); handles failures gracefully
  • Messenger action RampsService:getTokens added and wired; comprehensive tests for caching, normalization, error handling, and state transitions; changelog updated

Written by Cursor Bugbot for commit 750f506. 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
@georgeweiler georgeweiler added this pull request to the merge queue Jan 13, 2026
Merged via the queue into main with commit 53dbee1 Jan 13, 2026
290 checks passed
@georgeweiler georgeweiler deleted the TRAM-3018-ramp-get-tokens branch January 13, 2026 19:33
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