Commit 665035f
authored
feat: Add gas included swaps (#13430)
## **Description**
Users who don't have enough ETH to pay for gas fees while swapping will
be able to swap now if the gas fee can be taken from one of the tokens
they are swapping. Smart transactions must be enabled for this.
## **Related issues**
Fixes:
## **Manual testing steps**
Test case 1:
1. Make sure you are on Ethereum mainnet and have Smart Transactions on
in Advanced Settings
2. Have e.g. 0 ETH and 100 USDC
3. Fill in the swap form with 10 USDC -> ETH
6. You will see gas included swaps UI
Test case 2:
1. Make sure you are on Ethereum mainnet and have Smart Transactions on
in Advanced Settings
4. In Swaps you can now click on `Use max` for ETH
5. Get quotes
6. You will see gas included swaps UI
## **Screenshots/Recordings**
User doesn't have enough ETH for gas fees (gas included swaps):

User has enough ETH for gas fees:

### **Before**
<!-- [screenshots/recordings] -->
### **After**
<!-- [screenshots/recordings] -->
## **Pre-merge author checklist**
- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
## **Pre-merge reviewer checklist**
- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.1 parent ed21162 commit 665035f
14 files changed
Lines changed: 791 additions & 212 deletions
File tree
- app
- components
- UI/Swaps
- __snapshots__
- utils
- core/Engine
- util/smart-transactions
- locales/languages
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| 242 | + | |
242 | 243 | | |
243 | 244 | | |
244 | 245 | | |
| |||
335 | 336 | | |
336 | 337 | | |
337 | 338 | | |
338 | | - | |
| 339 | + | |
339 | 340 | | |
340 | 341 | | |
341 | 342 | | |
| |||
405 | 406 | | |
406 | 407 | | |
407 | 408 | | |
408 | | - | |
| 409 | + | |
| 410 | + | |
409 | 411 | | |
410 | 412 | | |
411 | 413 | | |
| |||
0 commit comments