Skip to content

Positions live in sessionStorage and are lost when the tab closes #205

Description

@Muyideen-js

Problem

frontend/script.js keeps the user's positions in memory and mirrors them to sessionStorage
(POSITION_STORAGE_KEY, line ~20). Three consequences follow:

  1. They vanish. sessionStorage is cleared when the tab closes. A confirmed on-chain bet
    disappears from the dashboard even though it is permanently recorded on Stellar.
  2. They do not follow the user. Open the site in another browser, or on a phone, and the
    position history is empty.
  3. They can lie. The list is whatever the browser wrote locally, never reconciled against the
    chain. A transaction that succeeded on chain but failed to write locally is invisible, and a
    stale local entry is never corrected.

The contract exposes the real data: get_bet, get_bet_gross, get_position,
get_user_bet_count, get_market_bettors_page.

Acceptance criteria

  • Positions are reconstructed from chain state on load, keyed by the connected address
  • Reconnecting the same wallet in a fresh browser shows the same positions
  • Local storage is a cache for responsiveness only, never the source of truth
  • Each position shows stake, side, market status, and payout state from the contract
  • Disconnecting clears the view; connecting a different wallet loads that address's positions

Why this is critical

Users cannot reliably see what they own. Combined with the missing claim flow, someone can stake
XLM and end up with no record in the UI that they ever did.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: frontendWeb client, wallet, and user experiencebugSomething isn't workingpriority: criticalCritical to protocol safety or mainnet readiness

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions