Skip to content

Remove v1 token-prices fallback - #3078

Merged
JakeUrban merged 2 commits into
masterfrom
claude/nifty-pasteur-a5ekw1
Nov 10, 2026
Merged

JakeUrban merged 2 commits into
masterfrom
claude/nifty-pasteur-a5ekw1

Conversation

@JakeUrban

Copy link
Copy Markdown
Contributor

What

The extension 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:

  • getTokenPrices always sends POST /token-prices?network=… to freighter-backend-v2 through the background service worker. It does not call INDEXER_URL/token-prices anymore.
  • getTokenPrices does not take a useV2 argument anymore.
  • The Amplitude flag use_token_prices_v2 has no effect. The extension does not read it. tokenPricesV2Selector is removed.
  • The confirmation price snapshot always reports amount_usd_source: "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.
  • Futurenet and custom passphrases still skip the request.
  • Balances, Blockaid, submit and simulate still use INDEXER_URL. 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. After this change, a rollback to v1 is not possible.

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.
  • This PR has narrow scope and does not mix refactoring with feature changes.
  • This PR adds tests for the new functionality or fixes. (Tests for the v1 path are removed. The v2 tests stay.)
  • These changes have been tested in both Chrome and Firefox.
  • This PR includes relevant before and after screenshots for UI changes. (No UI change.)
  • I took the time to review my own PR.

Checks run locally: tsc passes. Jest: 292 suites pass. testNodeCompat.js fails because it needs a build; it fails on master too.

Follow-up after release: archive use_token_prices_v2 in Amplitude. Then remove the v1 price worker and /token-prices route in freighter-backend.


Generated by Claude Code

The clients now get 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.

- getTokenPrices no longer takes a useV2 argument.
- Remove tokenPricesV2Selector and the flag from remote config.
- 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The reviewed changes consistently remove the retired v1 and feature-flag plumbing while updating the related API, telemetry, snapshots, and tests for the v2-only flow, with no active issues identified.

No open issues 🎉

What changed in this PR

This pull request removes the legacy v1 token-prices path and its use_token_prices_v2 feature flag, making freighter-backend-v2 the sole token-pricing source while updating confirmation telemetry and tests.

Changes:

  • Routes supported token-price requests exclusively through the authenticated v2 background-service-worker endpoint.
  • Removes the feature flag, selector, API parameter, and related call-site plumbing.
  • Updates confirmation snapshots and test coverage for v2-only behavior, including filtering, network handling, and contract-token support.
File Description
extension/​src/​popup/​views/​AddToken/​__tests__/​AddToken.test.tsx Removes obsolete token-prices feature-flag state from test fixtures.
extension/​src/​popup/​views/​__tests__/​Account.test.tsx Removes obsolete token-prices feature-flag state from account test fixtures.
extension/​src/​popup/​ducks/​remoteConfig.ts Removes the token-prices feature flag and selector.
extension/​src/​popup/​ducks/​__tests__/​remoteConfig.test.ts Removes tests for the retired token-prices flag and selector.
extension/​src/​popup/​components/​InternalTransaction/​SubmitTransaction/​hooks/​useSubmitTxData.tsx Stops reading and forwarding the removed token-prices feature flag.
extension/​src/​popup/​components/​account/​AccountSheet/​hooks/​__tests__/​useGetWalletsData.test.tsx Updates token-price mock expectations for the simplified API.
extension/​src/​popup/​components/​__tests__/​maintenanceMode.test.tsx Removes obsolete token-prices remote-config test state.
extension/​src/​helpers/​hooks/​useGetTokenPrices.tsx Uses the simplified v2-only token-prices API.
extension/​src/​helpers/​confirmationPriceSnapshot.ts Always uses the v2 price source and updated token-price API signature.
extension/​src/​helpers/​confirmationPriceSnapshot.test.ts Updates snapshot setup, cancellation mocks, and source expectations for v2-only pricing.
extension/​src/​helpers/​__tests__/​useGetTokenPrices.test.tsx Updates hook expectations after removing the feature-flag argument.
extension/​src/​helpers/​__tests__/​useGetBalances.test.tsx Removes obsolete token-prices feature-flag state from balance test fixtures.
@shared/​api/​internal.ts Deletes the v1 request path and routes supported token-price requests through backend v2 while retaining filtering and network handling.
@shared/​api/​__tests__/​internal.test.ts Removes v1 endpoint coverage and updates v2 request, filtering, network, and response tests.

Review effort: Lite

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

PR Preview build is ready: https://github.com/stellar/freighter/releases/tag/untagged-f1005c8e0c39dee8ce54
Backend: V1 prod + V2 beta (no sandbox configured for @JakeUrban). SDF collaborators only — install instructions in the release description.

@JakeUrban
JakeUrban marked this pull request as ready for review November 10, 2026 16:15
Resolve the conflict with #3064 in useGetTokenPrices. That change waits
for the remote config flags before it reads use_token_prices_v2. This
branch removes that flag, so the price hook does not wait for the flags.
The balances hook still waits, because use_balances_v2 picks its
endpoint.

- Replace the new "waits for the flags" price test with a test that
  prices are fetched without a wait.
- Remove use_token_prices_v2 from the new test fixtures.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01R8cp3zUn1aPP4zQrPvEFDQ
@JakeUrban
JakeUrban merged commit bb99fdd into master Nov 10, 2026
11 checks passed
@JakeUrban
JakeUrban deleted the claude/nifty-pasteur-a5ekw1 branch November 10, 2026 23:48
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.

4 participants