Skip to content

feat: Add Across Gas Station support#8588

Merged
pedronfigueiredo merged 1 commit intomainfrom
pnf/gasless-across
May 4, 2026
Merged

feat: Add Across Gas Station support#8588
pedronfigueiredo merged 1 commit intomainfrom
pnf/gasless-across

Conversation

@pedronfigueiredo
Copy link
Copy Markdown
Contributor

@pedronfigueiredo pedronfigueiredo commented Apr 27, 2026

Summary

  • Add a shared Gas Station helper and keep Relay using it via the existing relay helper path.
  • Let Across quote source-network fees in the source token when native balance is insufficient and Gas Station is eligible.
  • Re-quote max-amount Across flows after reserving source token for gas-fee-token payment.
  • Pass gasFeeToken when submitting Across source transactions that use source-token gas payment.

Note

Medium Risk
Changes how Across quotes and submissions handle gas pricing when native balance is insufficient, including a new two-phase re-quote path for max-amount flows; mistakes could lead to unaffordable quotes or incorrect gas token selection.

Overview
Adds Gas Station (gas-fee-token) support to the Across strategy: when the user’s native balance can’t cover fees.sourceNetwork, Across can now price source-network gas in the source token via a shared utils/gas-station helper and marks quotes with fees.isSourceGasFeeToken.

For max-amount Across quotes, introduces a two-phase flow that re-quotes after subtracting the estimated gas-fee-token cost from the input amount, with guarded fallbacks back to the original quote if the adjusted quote is invalid/unaffordable.

During Across submission, passes gasFeeToken to TransactionController:addTransaction / addTransactionBatch when fees.isSourceGasFeeToken is set, enabling the source-token gas payment on-chain. Also refactors Relay to import the gas-station helpers from utils/gas-station and updates/extends tests accordingly, plus a changelog entry.

Reviewed by Cursor Bugbot for commit c219b14. Bugbot is set up for automated code reviews on this repo. Configure here.

@pedronfigueiredo pedronfigueiredo marked this pull request as ready for review April 27, 2026 12:57
@pedronfigueiredo pedronfigueiredo requested review from a team as code owners April 27, 2026 12:57
@pedronfigueiredo pedronfigueiredo changed the title Add Across Gas Station support feat: Add Across Gas Station support Apr 27, 2026
@pedronfigueiredo pedronfigueiredo self-assigned this Apr 27, 2026
OGPoyraz
OGPoyraz previously approved these changes Apr 28, 2026
Copy link
Copy Markdown
Member

@OGPoyraz OGPoyraz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No major comments apart from relocating the utilities 👍

Comment on lines +1 to +5
export {
getGasStationCostInSourceTokenRaw,
getGasStationEligibility,
} from '../gas-station';
export type { GasStationEligibility } from '../gas-station';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we get rid of this file and use utility file directly when needed?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we relocate this file under packages/transaction-pay-controller/src/utils?

@pedronfigueiredo pedronfigueiredo added this pull request to the merge queue May 4, 2026
Merged via the queue into main with commit c8883a1 May 4, 2026
366 checks passed
@pedronfigueiredo pedronfigueiredo deleted the pnf/gasless-across branch May 4, 2026 09:59
@OGPoyraz OGPoyraz mentioned this pull request May 4, 2026
4 tasks
pull Bot pushed a commit to dmrazzy/core that referenced this pull request May 4, 2026
## Explanation

Release `955.0.0` with a major version bump for:

- **`@metamask/transaction-pay-controller`** `20.2.0` → `21.0.0`

### `@metamask/transaction-pay-controller@21.0.0`

**Breaking:** Narrow `AllowedActions` type to use individual action
types instead of compound controller action unions
(`BridgeControllerActions`, `BridgeStatusControllerActions`,
`CurrencyRateControllerActions`, `GasFeeControllerActions`)

Other changes:
- Add Gas Station support for Across source transactions when native
balance is insufficient
- Pass explicit `assetId`, `providers`, and `fiat` to
`RampsController:getQuotes` and persist the selected ramps quote on
`TransactionFiatPayment`

### Dependency updates

No packages depend on `@metamask/transaction-pay-controller`, so no
dependency range updates were needed.

## References

- [MetaMask#8670](MetaMask#8670) — Narrow
`AllowedActions` to individual action types (BREAKING)
- [MetaMask#8588](MetaMask#8588) — Add Gas Station
support for Across source transactions
- [MetaMask#8628](MetaMask#8628) — Pass explicit
params to `RampsController:getQuotes` and persist `rampsQuote`

## Checklist

- [ ] I've updated the test suite for new or updated code as appropriate
- [ ] 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/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> This is primarily a release/versioning PR, but it publishes
`@metamask/transaction-pay-controller@21.0.0` which includes a
documented **breaking** `AllowedActions` type change that may require
consumer updates.
> 
> **Overview**
> Bumps the monorepo version to `955.0.0` and releases
`@metamask/transaction-pay-controller` from `20.2.0` to `21.0.0`.
> 
> Updates the `transaction-pay-controller` changelog with the `21.0.0`
release notes, including a **breaking** narrowing of the
`AllowedActions` type, plus Gas Station support for Across source
transactions and a ramps quoting fix.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
3a003ea. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants