Skip to content

[Extension] Route all freighter-backend-v2 calls through the authed fetch wrapper #2879

Description

@piyalbasu

Centralize the scattered INDEXER_V2_URL fetches through a single backend-v2 client built on authedFetch (#2770), so every request to freighter-backend-v2 carries a per-request JWT when the user is authenticated.

Today each call site builds its own fetch/URL against INDEXER_V2_URL:

  • @shared/api/internal.ts (e.g. /protocols)
  • @shared/api/helpers/fetchCollectibles.ts (/collectibles)
  • @shared/api/helpers/getLedgerKeyAccounts.ts (/ledger-key/accounts)
  • extension/src/background/helpers/account.ts (/rpc-health)
  • (plus any others reaching INDEXER_V2_URL)

Route them all through one wrapper that:

Part of the Unified User Model auth rollout: "whenever Freighter clients call freighter-backend-v2, they go through a wrapped fetch that derives the auth key and sends the JWT."

Depends on: #2769, #2770.

Acceptance:

  • All backend-v2 requests flow through the shared wrapper; no call site constructs its own fetch to INDEXER_V2_URL.
  • Authenticated requests (unlocked wallet) carry a valid JWT; locked / onboarding / watch-only requests still succeed anonymously.
  • No regression in existing endpoint behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions