Repository navigation
refactor(transaction-pay-controller): centralize server and relay recipient selection - #10887
Merged
Merged
Conversation
matthewwalsh0
force-pushed
the
pr1-recipient-fixes
branch
from
October 20, 2026 08:45
f70f4a2 to
5e0c970
Compare
matthewwalsh0
force-pushed
the
pr1-recipient-fixes
branch
2 times, most recently
from
October 22, 2026 19:46
3e14d2a to
9534b6a
Compare
matthewwalsh0
marked this pull request as ready for review
October 22, 2026 19:58
matthewwalsh0
temporarily deployed
to
default-branch
October 22, 2026 19:59 — with
GitHub Actions
Inactive
3 of 4 tasks
Merged
3 of 4 tasks
dan437
previously approved these changes
Oct 26, 2026
matthewwalsh0
force-pushed
the
pr1-recipient-fixes
branch
from
October 29, 2026 09:40
9534b6a to
f10bc20
Compare
cursor Bot
pushed a commit
that referenced
this pull request
Oct 29, 2026
Recipient selection moves into the strategies with #10887, so the explicit config property is no longer needed.
matthewwalsh0
enabled auto-merge
October 29, 2026 10:09
dan437
approved these changes
Oct 29, 2026
Naz-Ovh
pushed a commit
to 0x-fork/metamask-core
that referenced
this pull request
Nov 4, 2026
…trategies (MetaMask#11026) ## Explanation Hyperliquid perps handling was implemented separately in `RelayStrategy`, `AcrossStrategy` and `ServerStrategy`, and each one detected a perps deposit differently: - **Relay:** transaction type is in `PERPS_DEPOSIT_TYPES` (`perpsDeposit`, `perpsDepositAndOrder`). - **Across:** transaction type is exactly `perpsDeposit`. - **Server:** the transaction's `to` is the Hyperliquid bridge. This missed deposits made as an ERC-20 transfer to the bridge. The Server strategy also shifted perps withdraw amounts the wrong way (8 → 6 decimals instead of 6 → 8). This PR adds a shared `utils/perps.ts` that all three strategies use: - **`isPerpsDepositTransaction` / `isPerpsDepositRequest`:** detection that ignores the transaction type. A perps deposit is any transaction, or nested transaction, that calls the Hyperliquid bridge or makes an ERC-20 `transfer` to it, and whose request targets Arbitrum USDC (not post-quote). - **`normalizePerpsDepositRequest` / `normalizePerpsWithdrawRequest`:** rewrite the target/source to HyperCore and shift amounts from 6 to 8 decimals. Each takes the HyperCore USDC address from the caller, so each strategy still sets its own address: - Relay: `HYPERCORE_USDC_ADDRESS` (16-byte) - Across: `ACROSS_HYPERCORE_USDC_PERPS_ADDRESS` - Server: `SERVER_HYPERCORE_USDC_PERPS_ADDRESS` Other changes: - `source-amounts` uses the shared detection to decide when Across always needs a quote, instead of checking the transaction type. - `AcrossStrategy` now supports `perpsDepositAndOrder` as a HyperCore direct deposit. To match Relay, its submitted transaction is labelled `perpsAcrossDeposit`. - The fixed Server withdraw shift (6 → 8) now matches Relay. Stacked on MetaMask#10887. ## References - Stacked on MetaMask#10887 ## 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/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** > Changes how perps deposit/withdraw quotes are detected and amount-normalized across all pay strategies, including a Server withdraw decimal fix that affects quoted amounts. > > **Overview** > Introduces shared **`utils/perps.ts`** so Relay, Across, and Server use one path for Hyperliquid perps deposits and withdraws instead of three inconsistent implementations. > > **Detection** now keys off transaction calldata (direct bridge calls or ERC-20 **`transfer`** to the Hyperliquid bridge, including nested legs), not **`TransactionType`**. That aligns strategies and covers USDC **`transfer`** deposits the Server path previously missed. > > **Normalization** rewrites Arbitrum USDC quote requests to HyperCore and shifts amounts **6 → 8** decimals; each strategy still passes its own HyperCore token address. **`normalizePerpsWithdrawRequest`** fixes Server withdraw quoting, which had shifted decimals the wrong way. > > **Across** uses the shared helpers for support, destination routing, and quoting; submitted bridge legs label **`perpsAcrossDeposit`** for any type in **`PERPS_DEPOSIT_TYPES`** (including **`perpsDepositAndOrder`**). **`source-amounts`** treats Across Hyperliquid deposits as always needing a quote when calldata indicates a perps deposit, without checking transaction type. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 1d4d7ed. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Naz-Ovh
pushed a commit
to 0x-fork/metamask-core
that referenced
this pull request
Nov 4, 2026
## Explanation
Release 1377.0.0. This PR only bumps versions, finalizes changelogs,
updates dependency ranges, and refreshes `yarn.lock`. The behavior
shipped here is already on `main`.
Three packages are major releases because their unreleased changelogs
include breaking changes:
- `@metamask/transaction-controller` `72.3.0` → `73.0.0`. Simulation now
goes through `SentinelApiService:simulateTransactions`. Consumers must
construct a `SentinelApiService` and delegate that action.
`getSimulationConfig` now returns `{ newUrl?: string }` only
([MetaMask#9476](MetaMask#9476)).
- `@metamask/core-backend` `12.3.0` → `13.0.0`.
`OHLCV_SERVICE_ALLOWED_ACTIONS` no longer includes
`BackendWebSocketService:getConnectionInfo` or
`BackendWebSocketService:findSubscriptionsByChannelPrefix`
([MetaMask#10884](MetaMask#10884)). This release
also adds `fetchV5MultiAccountTransactions`
([MetaMask#11194](MetaMask#11194)),
`LaunchpadTokenDetailsService`, and `ChannelSubscriptionManager`
([MetaMask#10884](MetaMask#10884)).
- `@metamask/wallet` `20.0.0` → `21.0.0`. Default initialization now
includes `NetworkEnablementController`, and the wallet messenger
delegates `SentinelApiService:simulateTransactions`. Clients must
register `MultichainNetworkController:getState` and
`SentinelApiService:simulateTransactions` on the wallet messenger
([MetaMask#10997](MetaMask#10997),
[MetaMask#9476](MetaMask#9476)).
These packages are included so they can depend on
`transaction-controller` `^73.0.0` and, where they use it,
`core-backend` `^13.0.0`:
| Package | Version |
| --- | --- |
| `@metamask/assets-controller` | `20.1.0` |
| `@metamask/assets-controllers` | `113.0.1` |
| `@metamask/bridge-controller` | `83.1.3` |
| `@metamask/bridge-status-controller` | `78.0.1` |
| `@metamask/client-utils` | `3.1.0` |
| `@metamask/eip-5792-middleware` | `4.1.0` |
| `@metamask/gator-permissions-controller` | `6.1.0` |
| `@metamask/money-account-utils` | `2.2.0` |
| `@metamask/network-enablement-controller` | `7.1.0` |
| `@metamask/phishing-controller` | `18.3.0` |
| `@metamask/profile-metrics-controller` | `5.2.1` |
| `@metamask/shield-controller` | `7.1.1` |
| `@metamask/smart-transactions-controller` | `27.2.1` |
| `@metamask/social-controllers` | `3.14.1` |
| `@metamask/subscription-controller` | `15.1.2` |
| `@metamask/transaction-pay-controller` | `30.3.2` |
| `@metamask/transaction-pay-middleware` | `2.0.1` |
| `@metamask/user-operation-controller` | `42.1.0` |
Notable changes besides the dependency bumps:
- `@metamask/assets-controller`: optional `pricePercentChange5m` and
`pricePercentChange4h` on `FungibleAssetPrice`
([MetaMask#11201](MetaMask#11201)).
- `@metamask/client-utils`: `predictionSettled` on `ActivityKind`
([MetaMask#11169](MetaMask#11169)), plus fee fixes
for contract-interaction fallback and OP Stack L1/operator fees
([MetaMask#11013](MetaMask#11013),
[MetaMask#9630](MetaMask#9630)).
- `@metamask/network-enablement-controller`: preserve enablement when a
config-registry network is auto-enabled
([MetaMask#10763](MetaMask#10763)).
- `@metamask/phishing-controller`: Arc (`0x13b2`) token scanning
([MetaMask#11144](MetaMask#11144)).
- `@metamask/transaction-pay-controller`: shared recipient resolution
and Hyperliquid perps deposit detection
([MetaMask#10887](MetaMask#10887),
[MetaMask#11026](MetaMask#11026)).
`@metamask/earn-controller`, `@metamask/money-account-mfa-whitelist`,
`@metamask/money-account-upgrade-controller`,
`@metamask/network-connection-banner-controller`,
`@metamask/perps-controller`, and `@metamask/signature-controller` only
have dependency ranges updated. They are not version-bumped and are not
published in this release.
## References
* [MetaMask#9476](MetaMask#9476)
* [MetaMask#9630](MetaMask#9630)
* [MetaMask#10763](MetaMask#10763)
* [MetaMask#10884](MetaMask#10884)
* [MetaMask#10887](MetaMask#10887)
* [MetaMask#10997](MetaMask#10997)
* [MetaMask#11013](MetaMask#11013)
* [MetaMask#11026](MetaMask#11026)
* [MetaMask#11144](MetaMask#11144)
* [MetaMask#11169](MetaMask#11169)
* [MetaMask#11194](MetaMask#11194)
* [MetaMask#11201](MetaMask#11201)
## 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**
> The diff is low-risk mechanically, but the published majors force
client upgrades around transaction simulation, backend WebSocket
actions, and wallet messenger registration—areas that affect core wallet
behavior.
>
> **Overview**
> This PR cuts **release 1377.0.0** by bumping the root monorepo
version, publishing new semver tags for many `@metamask/*` packages,
moving unreleased changelog entries into versioned sections, updating
inter-package dependency ranges, and refreshing **`yarn.lock`**. There
is **no new application logic** in the diff—only release bookkeeping for
work already on `main`.
>
> The release centers on three **major** packages whose changelogs
document breaking changes: **`@metamask/transaction-controller`
`73.0.0`** (simulation via `SentinelApiService:simulateTransactions`;
`getSimulationConfig` shape change), **`@metamask/core-backend`
`13.0.0`** (WebSocket allowed-actions cleanup plus new backend
APIs/services), and **`@metamask/wallet` `21.0.0`** (default
`NetworkEnablementController` wiring and Sentinel simulation delegation
on the wallet messenger). Dozens of other packages are **minor/patch
bumped** mainly to depend on **`transaction-controller` `^73.0.0`** and,
where applicable, **`core-backend` `^13.0.0`**.
>
> Several workspaces only have **`package.json` dependency range
updates** (e.g. `earn-controller`, `money-account-upgrade-controller`,
`signature-controller`) without a version bump in this PR. A few
packages also document **feature fixes** in their new changelog sections
(e.g. `assets-controller` price change fields, `client-utils` activity
kinds/fees, `phishing-controller` Arc scanning) as part of the versions
being published here.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
5a253e4. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Merged
8 of 10 tasks
Cal-L
pushed a commit
to MetaMask/metamask-mobile
that referenced
this pull request
Nov 5, 2026
## **Description** <!-- mms-check: type=text required=true --> `tests/smoke-appium/confirmations/pay/predict-withdraw-to-money-account.spec.ts` has failed on every scheduled `main` iOS Appium confirmations smoke run since 2026-11-04 ~16:00 UTC (last pass: `02d9f392158`, first fail: `348f68fd49c`). It also fails unrelated PRs whenever iOS E2E is selected (e.g. #38422). After selecting **Money account** as the pay-with option, the transaction fee row never renders: ``` Error: element ("~bridge-fee-row") still not displayed at predict-withdraw-to-money-account.spec.ts:107 ``` The only dependency change in that window is the core bump in #38688 (`@metamask/transaction-controller` 72.3.0 → 73.0.0, `@metamask/transaction-pay-controller` ^30.3.1 → ^30.3.3, `@metamask/core-backend` ^12 → ^13). transaction-pay-controller 30.3.2 includes "Use shared recipient resolution for Relay and Server quotes" (MetaMask/core#10887), which is the likely cause. This is not yet confirmed. This PR skips the test on all platforms so CI is unblocked while the fix is investigated. Android was already skipped inside the test, so that inner platform skip is removed. The test should be re-enabled once the root cause is fixed. Failing runs: - main (scheduled): https://github.com/MetaMask/metamask-mobile/actions/runs/42025347013 - PR #38422: https://github.com/MetaMask/metamask-mobile/actions/runs/42017259777/job/127255034114 ## **Changelog** <!-- mms-check: type=changelog required=true blocking=true --> CHANGELOG entry: null ## **Related issues** <!-- mms-check: type=issue-link required=true --> Refs: #38688 ## **Manual testing steps** <!-- mms-check: type=manual-testing required=true --> N/A. Test-only change that skips an E2E spec. ## **Screenshots/Recordings** <!-- mms-check: type=screenshot required=true --> N/A. Failure recordings are in the `appium-smoke-videos-appium-confirmations-ios-smoke-1` artifact of the runs linked above. ### **Before** N/A ### **After** N/A ## **Pre-merge author checklist** <!-- mms-check: type=checklist required=true --> - [x] 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). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] 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. #### Performance checks (if applicable) - [x] I've tested on Android - N/A, test-only change - [x] I've tested with a power user scenario - N/A, test-only change - [x] I've instrumented key operations with Sentry traces for production performance metrics - N/A, test-only change ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Test-only change that skips a flaky E2E spec; no production code paths are modified. > > **Overview** > **Unblocks CI** by skipping the entire Appium smoke case *withdraws Predict balance directly to Money account* on all platforms, replacing the previous Android-only runtime skip. > > The skip comment documents a regression since the core bump in **#38686**: on iOS, after choosing **Money account** as pay-with, the fee UI (`bridge-fee-row`) never appears and the spec times out at `verifyTransactionFeeVisible`. The test should be re-enabled once that behavior is fixed. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit b60bb89. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Naz-Ovh
pushed a commit
to 0x-fork/metamask-core
that referenced
this pull request
Nov 7, 2026
…ansaction account (MetaMask#10992) <!-- CURSOR_AGENT_PR_BODY_BEGIN --> ## Explanation Post-quote flows used `accountOverride` as both the quote sender and the output recipient, so a Money Account withdrawal to a hardware wallet had to be signed by the hardware wallet, even though the Money Account holds the funds. Post-quote quotes are now always requested and submitted from the transaction's own `from`, and `accountOverride` only receives the output: Relay and Server pay it through the shared recipient resolution from MetaMask#10887, and Across pays it directly. Non-post-quote flows are unchanged, and so is the legacy Predict Safe withdraw, which sets no `accountOverride`; new tests cover it with and without one. This is breaking: clients must leave post-quote funds on the transaction's `from`. For example, a Money Account withdrawal that needs a quote must no longer move the withdrawn mUSD to `accountOverride` in its nested calls. ## References Needed by the extension's Money Account withdrawal to hardware wallets: MetaMask/metamask-extension#47111 ## 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/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_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-b224c296-30b2-53ee-a2b9-8536628aa87f?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-b224c296-30b2-53ee-a2b9-8536628aa87f&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Breaking change to post-quote signing and fund-location assumptions in transaction pay flows; incorrect client updates could mis-route withdrawals or fail quotes, though scope is limited to post-quote and is heavily tested. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit e81627b. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Matthew Walsh <matthew.walsh@consensys.net> Co-authored-by: Daniel <dan437@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
Use shared recipient resolution for Relay and Server quotes, and share post-quote payment override preparation across both strategies. This consolidates duplicated strategy-specific logic and carries the resolved quote recipient through to second-leg submission.
Regression coverage includes account overrides, non-atomic payment overrides, max deposits, and provider-deferred execution from quote construction through submission.
Validation: the full transaction-pay-controller test suite, package lint and formatting, build, changelog validation, and repository type-error budget check pass.
References
Checklist
Note
Medium Risk
Changes how quote recipients and post-quote funding are chosen across Relay and Server, including stricter override validation and updated second-leg flags—incorrect routing could mis-settle funds in Money Account and account-override flows.
Overview
Relay and Server quote construction now share
resolveQuoteRecipientandprocessPostQuotePaymentOverride, replacing strategy-localresolveNonAtomicRecipient,resolveSettledRequest, and duplicated Money Account post-quote helpers insecond-leg,relay-quotes, andserver-quotes.Recipient behavior is aligned across providers: deposits fund
txParams.from(execution account) even when the payer differs; ordinary post-quote withdrawals payrequest.from; non-atomic post-quote flows use the client override callback recipient. Post-quote overrides no longer fall back whengetPaymentOverrideDataomits a recipient—Relay throws and Server skips the quote with an empty result.Atomic Money Account overrides still embed funding transfers plus override calls (Relay) or settle on the override recipient with bundled calls (Server). Normalized quotes carry the resolved
recipientthrough to second-leg submission, including deferred Server execution when payer and execution account differ.Reviewed by Cursor Bugbot for commit f10bc20. Bugbot is set up for automated code reviews on this repo. Configure here.