Skip to content

[#432] Zap v2 Frontend UI: Multi-token selector on TradingWidget #435

@realproject7

Description

@realproject7

Parent: #432

Depends on: #434 (lib/zap.ts must be updated first)

Summary

Update TradingWidget.tsx to support multiple input tokens on the buy tab.

Token Selector

Add token selector on buy tab with options:

  • ETH — payable via Zap, no approval needed
  • USDC — approve to Zap → mint (two-step)
  • HUNT — approve to Zap → mint (two-step)
  • PLOT — direct MCV2_Bond.mint (existing behavior, no Zap)

Default: ETH

UI

  • Minimal toggle/dropdown matching existing design (monospace, text-xs, border tokens)
  • Show balance for selected input token
  • Show estimate in selected input token
  • For ERC-20 inputs: "Approving..." → "Confirm in wallet..." flow (same pattern as current PLOT approve → mint)

Behavior

  • ETH: writeContractAsync({ value: ethCost }) — payable, no approval step
  • USDC/HUNT: check allowance → approve if needed → writeContractAsync() with no value
  • PLOT: existing MCV2_Bond.mint flow unchanged (no Zap contract involved)
  • Sell tab: unchanged — always returns PLOT via MCV2_Bond.burn
  • isZapAvailable check remains (hides selector when Zap address is zero)
  • Trade indexing (/api/index/trade POST) fires for all modes

Acceptance Criteria

  • Token selector renders on buy tab (ETH, USDC, HUNT, PLOT)
  • Balance displays correctly for each token
  • Estimates display in selected input token
  • ETH mode: single tx, no approval
  • USDC/HUNT mode: approve → zap flow
  • PLOT mode: existing behavior preserved
  • Sell tab unchanged
  • Build passes

Branch

Same branch as #434: task/432-zap-v2-frontend in plotlink repo (combine in one PR)

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/T3Assigned to T3 builder agent

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions