fix(8667): trigger swap tx on approval tx confirmed #9173
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When swapping a token that needs approval (and requires a 2 step swap process), it's needed for the user, when using a hardware wallet, to manually sign transactions. Currently, second modal opening is triggered when approval transaction is finished (meaning when it has been submitted). But this would end up in a situation where the first modal was not unmounted before it was asked to be mounted again. This flow was creating an issue where the user could not confirm the second transaction (as second modal was never displayed)
To mitigate this issue, we choose to wait for first transaction completion before starting the second one. This is not perfect from user POV as a long delay can happen between approval and swap txs, but as discussed with @AlexJupiter and @gantunesr it's considered as a temporary solution until we figure out a long term one.
Related issues
Fixes: #8667
Manual testing steps
For ease the explanation, we are using
AAVE
andMATIC
on Polygon network and will sign txs with a Ledger account. You also need blind signing to be enabled on your Ledger device.AAVE
token approval has been revoked here https://polygonscan.com/tokenapprovalchecker for your Ledger accountAAVE
token as origin token0.0000001
is fine)MATIC
token as destination tokenScreenshots/Recordings
Before
https://recordit.co/Vg7MLtediW
After
Record_2024-04-09-14-29-50.mp4
Pre-merge author checklist
Pre-merge reviewer checklist