Skip to content

fix(trade): prevent stale intent during quote preparation #565

Description

@Trynax

The Classic and Custom trade forms allow parts of the trade intent to change while asynchronous trade preparation is pending.

In the Classic flow, the side, amount, and slippage values are captured before /api/trade/prepare resolves, but the side controls, amount input, slippage input, and Max button remain editable while the request is pending.

In the Custom flow, the market selector, side controls, amount input, and slippage input remain editable while /api/custom-launch/v2/trade/prepare is pending. The response stores the earlier request and prepared transaction, while the review state can render current market and direction values. Confirmation then submits the earlier prepared transaction.

I’d like to:

  • Lock all mutable trade controls while preparation or balance loading is pending.
  • Prevent a second preparation from starting during an active operation.
  • Keep the existing review, wallet, API, and contract behavior unchanged.
  • Add focused coverage for the pending control state.

This will keep the review screen and wallet handoff bound to the same user intent that started the preparation request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions