Skip to content

feat(sub-accounts): wire all data hooks to active account #76

@vipineth

Description

@vipineth

Parent PRD

#75

What to build

Complete the active-account data wiring so every piece of data shown in the trading terminal reflects the selected account, not always the master wallet. The foundation (store, useActiveAddress, useSubAccounts, user menu switching, useAllDexsAccountState) was built as part of the initial sub-account exploration. This slice finishes the job by updating the remaining hooks that still read directly from wagmi's useConnection.

Hooks to migrate:

  • use-fee-rates — controls displayed fee tier and fee estimates in the order form
  • use-asset-leverage — controls the leverage subscription and position check for the active market
  • useUserPositions (hl-react) — positions data consumed by use-asset-leverage; needs an app-level wrapper or an address parameter so it subscribes to the active account's position stream

When a sub-account is selected, switching from it back to master should immediately restore master account data across all of these.

Acceptance criteria

  • Selecting a sub-account in the user menu causes the fee rate displayed in the order form to reflect that sub-account's fee tier
  • The leverage panel shows the leverage and margin mode of the active account's position, not the master's
  • The position check (has open position?) used to gate margin mode switching reflects the active account
  • Switching back to master instantly restores master account data in all panels
  • isConnected remains sourced from wagmi (wallet-level), only the address switches per selected account

Blocked by

None — can start immediately

User stories addressed

  • User story 13 (all terminal data reflects the currently active account)

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