You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The app gets token prices only from freighter-backend-v2. This PR removes the v1 /token-prices path and the use_token_prices_v2 feature flag.
Functional changes:
fetchTokenPrices always sends POST /token-prices to freighter-backend-v2 with the network query param. It does not call freighterBackendV1 for prices anymore.
fetchTokenPrices does not take a useV2 argument anymore. The native-ID translation (XLM to native and back) now always runs.
The prices store does not track which endpoint filled each network cache. sourceByNetwork and reconcileSource are removed. A response is not dropped because of a flag change anymore.
The Amplitude flag use_token_prices_v2 has no effect. The app does not read it. It is removed from remote config, from the price callers (balances, account fiat totals, swap, send, Blockaid balance list) and from the confirmation snapshot.
The confirmation price snapshot always reports priceSource: "token_prices_v2". The value does not change for users on the default path, so dashboards keep working.
These items do not change:
LP shares are still removed from the request.
Contract (SEP-41) tokens are still sent.
Only mainnet gets prices. Testnet and futurenet still skip the request.
Other v1 calls (balances, simulate, submit, Blockaid, token details) do not change. The use_balances_v2 flag is not touched.
Why
The v1 token price service on freighter-backend is not healthy. Repair is not useful, because v2 replaces it. The flag defaults to v2, so users on current versions do not use v1.
Known limitations
After this change, a rollback to v1 prices through Amplitude is not possible. Old app versions that do not have the flag still call v1. This PR cannot change that.
Screenshots / video
N/A. There is no UI change.
Before
After
N/A
N/A
Checklist
I have read CONTRIBUTING.md and this PR meets its requirements.
PR structure
This PR does not mix refactoring changes with feature changes (break it down into smaller PRs if not).
This PR has reasonably narrow scope (break it down into smaller PRs if not).
This PR includes relevant before and after screenshots/videos highlighting these changes. (No UI change.)
I took the time to review my own PR.
Testing
These changes have been tested and confirmed to work as intended on Android.
These changes have been tested and confirmed to work as intended on iOS.
These changes have been tested and confirmed to work as intended on small iOS screens.
These changes have been tested and confirmed to work as intended on small Android screens.
I have tried to break these changes while extensively testing them.
This PR adds tests for the new functionality or fixes. (Tests for the v1 path and the rollback cache logic are removed. The v2 tests stay.)
Release
This is not a breaking change.
This PR updates existing JSDocs when applicable.
This PR adds JSDocs to new functionalities.
I've checked with the product team if we should add metrics to these changes.
I've shared relevant before and after screenshots/videos highlighting these changes with the design team and they've approved the changes.
Checks run locally: tsc --noEmit passes. Jest: 345 suites pass. 2 suites fail: __tests__/config/theme.test.ts and __tests__/scripts/stellar-testnet.test.ts. They fail on main too. The cause is the local install, which skipped native builds such as sharp.
The app now gets token prices only from freighter-backend-v2. The v1
/token-prices path on freighter-backend is removed, together with the
use_token_prices_v2 feature flag that selected it.
- fetchTokenPrices no longer takes a useV2 argument.
- The prices store no longer tracks which endpoint filled its cache.
- Remove the flag from remote config and from all callers.
- The confirmation price snapshot always reports token_prices_v2.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01R8cp3zUn1aPP4zQrPvEFDQ
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Active issues remain: a misleading comment needs correction, and missing reset-generation guards allow stale in-flight price responses to repopulate cleared or newly selected account data.
This PR completes the migration of mobile token-price requests to freighter-backend-v2 by removing the v1 fallback, endpoint-selection flag, and source-specific cache bookkeeping while preserving network scoping, native-token translation, contract-token support, and confirmation analytics compatibility.
Changes:
Routes all token-price requests through the v2 network-scoped endpoint.
Removes the use_token_prices_v2 flag and related caller dependencies.
Updates price state, confirmation snapshots, consumers, and tests for v2-only pricing.
File
Description
src/services/backend.ts
Makes freighter-backend-v2 the sole token-price endpoint and removes the endpoint-selection parameter.
The removed endpoint check also dropped in-flight price responses
after clearAccountData. Without it, a late response can write the
old account's prices back into the cleared store.
- Add a reset action to the prices store. It clears the data and
advances a reset generation.
- Both fetch actions compare the generation after the request and
drop the response when a reset happened.
- clearAccountData calls the reset action.
- Correct a comment that said the prices backend rejects contract
tokens on v2.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01R8cp3zUn1aPP4zQrPvEFDQ
This sentence is grammatically incomplete and makes the identifier being rejected unclear. Please retain the concrete subject so the comment remains understandable, e.g. say that the endpoint cannot price this malformed XLM: identifier and that it does not match the balance-side XLM key.
The reason will be displayed to describe this comment to others. Learn more.
is this meant to cover stale quotes or prices from before an account switch? The comment at the top makes it sound like that latter - "the guard keeps the old account's prices out of the cleared store.
I think there is no difference in prices across accounts and the overlap between two requests would be a tiny window and rarely overlap. This can also result in a re-paint where the UI briefly shows -- for funded rows if fetchPricesForTokenIds is in flight while the user changes accounts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The app gets token prices only from freighter-backend-v2. This PR removes the v1
/token-pricespath and theuse_token_prices_v2feature flag.Functional changes:
fetchTokenPricesalways sendsPOST /token-pricesto freighter-backend-v2 with thenetworkquery param. It does not callfreighterBackendV1for prices anymore.fetchTokenPricesdoes not take auseV2argument anymore. The native-ID translation (XLMtonativeand back) now always runs.sourceByNetworkandreconcileSourceare removed. A response is not dropped because of a flag change anymore.use_token_prices_v2has no effect. The app does not read it. It is removed from remote config, from the price callers (balances, account fiat totals, swap, send, Blockaid balance list) and from the confirmation snapshot.priceSource: "token_prices_v2". The value does not change for users on the default path, so dashboards keep working.These items do not change:
use_balances_v2flag is not touched.Why
The v1 token price service on freighter-backend is not healthy. Repair is not useful, because v2 replaces it. The flag defaults to v2, so users on current versions do not use v1.
Known limitations
After this change, a rollback to v1 prices through Amplitude is not possible. Old app versions that do not have the flag still call v1. This PR cannot change that.
Screenshots / video
N/A. There is no UI change.
Checklist
PR structure
Testing
Release
Checks run locally:
tsc --noEmitpasses. Jest: 345 suites pass. 2 suites fail:__tests__/config/theme.test.tsand__tests__/scripts/stellar-testnet.test.ts. They fail onmaintoo. The cause is the local install, which skipped native builds such assharp.Companion PR for the extension: stellar/freighter#3078
Follow-up after release: archive
use_token_prices_v2in Amplitude. Then remove the v1 price worker and/token-pricesroute in freighter-backend.🤖 Generated with Claude Code
https://claude.ai/code/session_01R8cp3zUn1aPP4zQrPvEFDQ