Commit a1c0fa8
authored
feat: gas station support for relay source transactions (#7193)
## Explanation
Use gas fee tokens for deposit transactions in Relay strategy, if native
balance is insufficient for max fee.
## References
Related to
[#6150](MetaMask/MetaMask-planning#6150)
## Checklist
- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs),
highlighting breaking changes as necessary
- [x] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Enables using a gas fee token for Relay source network fees when
native balance is insufficient, propagating through quotes, totals, and
submission.
>
> - **Relay strategy (quotes)**:
> - Compute source network fee using gas fee token if native balance <
max fee; add `fees.isSourceGasFeeToken` and use
`TransactionController:getGasFeeTokens` to match source token, including
batch estimation and normalized `value`.
> - Keep native-fee path as fallback; total gas across multiple txs;
fallback gas when missing.
> - **Submission**:
> - Pass `gasFeeToken` to `addTransaction`/`addTransactionBatch` when
`fees.isSourceGasFeeToken` is true.
> - **Utils**:
> - Add `calculateGasFeeTokenCost` and use it in source-fee calculation;
refactor transaction gas fee token cost path.
> - **Types/Totals**:
> - Extend `TransactionPayFees` and `TransactionPayTotals` with optional
`isSourceGasFeeToken`.
> - **Tests/Mocks/Docs**:
> - Update tests and messenger mock to cover gas fee token flow; update
CHANGELOG.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
6407120. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent acbb6c0 commit a1c0fa8
File tree
11 files changed
+581
-171
lines changed- packages/transaction-pay-controller
- src
- strategy/relay
- tests
- utils
11 files changed
+581
-171
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
10 | 15 | | |
11 | 16 | | |
12 | 17 | | |
| |||
0 commit comments