If independent swap and transfer calls are sent within the same second, there is no guarantee which will be executed first. There should be a dedicated worker that orders these calls by nonce. And an endpoint that has both fields merged to execute the 4 calls correctly i.e.
- approve
- approve
- swap
- transfer
Temporary mitigation for clients is to sleep for around 200ms-1s between each subsequent call. However this is meant as a stopgap only.
If independent swap and transfer calls are sent within the same second, there is no guarantee which will be executed first. There should be a dedicated worker that orders these calls by nonce. And an endpoint that has both fields merged to execute the 4 calls correctly i.e.
Temporary mitigation for clients is to sleep for around 200ms-1s between each subsequent call. However this is meant as a stopgap only.