Skip to content

Mobile Swap: refactor approval screen and wire it to trade data #21192

@vytick

Description

@vytick

We want to present approval for transactions that need approval and show the current state and possibilities.

  • fix getApprovalStatus: To get status approved use const isApprovalTxPreApproved = selectedQuote?.preapprovedStringAmount && selectedQuote.preapprovedStringAmount !== '0'; instead of current condition
  • If getApprovalStatus returns needs_approval go to approval screen instead of preview screen
  • preview screen should accept route parm that means that there was previously successful revoke and show the alert. Hide it otherwise.
  • inspect code in desktop to find out when to show: You’ve approved this token, but the limit is too low. Increase it to continue.
  • There should be preselected DexApprovalType. Default value is 'INFINITE'
  • If user wants to change it, bottomsheet values should show the unlimited (INFINITE) and the amount that is in sendStringAmount (MINIMAL).
  • selecting one or another should save the new type to the state and similar to desktop implementation it should: save the trade with selected type, call useExchangeFlow.confirmTrade with the new approval type, and call useExchangeFlow.fetchFeesAndCompose

If anywhere during implementation you come to a conclusion approve and revoke screens should be one, feel free to merge them. We were not sure in the past how will the flow actually work better so we separated them for easier delivery.

Figma with approval and revoke flows

Metadata

Metadata

Assignees

Labels

mobileSuite Lite issues and PRs

Type

Projects

Status

🏃‍♀️ In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions