Skip to content

Trade and portfolio pages ignore the selected network #61

@Mosas2000

Description

@Mosas2000

Several frontend pages still fetch read-only data from STACKS_MAINNET directly instead of using the active network from the app context.

Evidence:

  • frontend/src/pages/TradePage.tsx:4,66-73 imports STACKS_MAINNET and passes it to fetchCallReadOnlyFunction for get-market.
  • frontend/src/pages/PortfolioPage.tsx:4,40-47,74-81 does the same for get-user-position.
  • The app already exposes network switching through NetworkContext, so these pages bypass the selected network.

Impact:

  • Switching to testnet still leaves these pages reading mainnet contract state.
  • Trade/portfolio views can show the wrong market data or fail outright when the selected network differs from mainnet.

Reproduction:

  1. Switch the app to testnet.
  2. Open a market in Trade or Portfolio.
  3. Observe that the read-only contract calls still target mainnet.

Priority: High

Suggested scope:
Use the active network from the network context or network utilities for all read-only contract calls in these pages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions