This repository was archived by the owner on Aug 26, 2025. It is now read-only.
Commit acdc35a
authored
Fix: Prevented infinity swap tx sending on user rejection (#204)
### Description
It prevents infinity swap tx sending on user rejection by adding the
`swapRejectedRef` setting when it's been rejected by the user (checking
via error message).
**Additionally, to read:**
The `useState` doesn't work in this case because the React state updates
asynchronously, so useEffect does not immediately pick up the change in
isSwapRejected during the first rejection (that's why I had a case when
the first rejection is ignored).
### Other changes
None
### Tested
Reject when there's an approval and a swap TXs.
1. Select tokens to have an approval TX first (the eXOF would be a good
choice).
2. Click the 'Continue' button.
3. Wait until the 'Approve ${token}' button is enabled to click.
4. Click the 'Approve ${token}' button.
5. Approve the approval TX.
6. Reject the swap TX.
Reject when there's no approval TX.
1. Select tokens to avoid an approval TX (a precondition is to swap some
tokens before).
2. Click the 'Continue' button.
3. Wait until the 'Swap' button is enabled to click.
4. Click the 'Swap' button.
5. Reject the swap TX.
### Related issues
- Fixes #issue number here
### Checklist before requesting a review
- [ ] I have performed a self-review of my own code
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] The PR title follows the
[conventions](https://www.notion.so/Git-Branching-and-Commit-Message-Conventions-18f66f7d06444cfcbac5725ffbc7c04a?pvs=4#9355048863c549ef92fe210a8a1298aa)
- [ ] I have run the [regression
tests](https://www.notion.so/Mento-Web-App-Regression-Tests-37bd43a7da8d4e38b65993320a33d557)1 parent ff6f1a1 commit acdc35a
1 file changed
+18
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
| 153 | + | |
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
| 167 | + | |
166 | 168 | | |
167 | 169 | | |
168 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
169 | 178 | | |
170 | 179 | | |
171 | 180 | | |
172 | 181 | | |
173 | 182 | | |
174 | 183 | | |
175 | 184 | | |
| 185 | + | |
176 | 186 | | |
177 | | - | |
178 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
179 | 192 | | |
180 | 193 | | |
181 | 194 | | |
| |||
0 commit comments