Skip to content

Commit a1c0fa8

Browse files
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

11 files changed

+581
-171
lines changed

packages/transaction-pay-controller/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Use gas fee token for Relay deposit transactions if insufficient native balance ([#7193](https://github.com/MetaMask/core/pull/7193))
13+
- Add optional `fees.isSourceGasFeeToken` property to `TransactionPayQuote` and `TransactionPayTotals` type.
14+
1015
## [9.0.0]
1116

1217
### Changed

0 commit comments

Comments
 (0)