Skip to content

[QA-Bug] Trade/Donate — show balance, validate before tx, add max button #159

@realproject7

Description

@realproject7

Problem

The Trade and Donate panels have no balance awareness — users can't see how much they have or easily input the max amount.

1. Show relevant token balance

  • Buy tab: Show user's reserve token balance (WETH on testnet / $PLOT on mainnet)
  • Sell tab: Show user's storyline token balance
  • Donate: Show user's reserve token balance

Display format: Balance: 0.05 WETH below the input field

2. Pre-validate before tx submission

  • If user enters an amount exceeding their balance, show inline error and disable the button
  • Prevents failed transactions and wasted gas
  • Check: balance >= input amount (for sell/donate), balance >= estimated cost (for buy)

3. Max input button

  • Add a "MAX" button next to the input field
  • Clicking it fills the input with the user's full available balance
  • For buy: use balance of reserve token
  • For sell: use balance of storyline token
  • For donate: use balance of reserve token

Acceptance Criteria

  • Token balance displayed in Buy, Sell, and Donate panels
  • Balance updates after each successful trade
  • Inline validation error when amount > balance, button disabled
  • "MAX" button fills input with full balance
  • Works on mobile (375px)

Files likely affected

  • src/components/TradingWidget.tsx
  • src/components/DonateWidget.tsx

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions