Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
23d124c
feat(swaps): track input primary denomination
bfullam Jun 16, 2026
b191462
chore(swaps): keep existing metric types unchanged
bfullam Jun 16, 2026
324d358
chore(swaps): restore page viewed type comment
bfullam Jun 16, 2026
b240d2e
Merge remote-tracking branch 'origin/main' into swaps/fiat-denominati…
bfullam Jun 16, 2026
c42cbdd
chore: bump root monorepo version for release
bfullam Jun 16, 2026
872d31a
fix: resolve CI constraints and test failures for fiat denomination
bfullam Jun 16, 2026
2931db6
chore: trim redundant fiat denomination test coverage
bfullam Jun 16, 2026
30beb7b
chore: fix release changelog sections for PR #9147
bfullam Jun 16, 2026
09a0973
chore: add bridge-controller Unreleased changelog entry for PR check
bfullam Jun 16, 2026
0d22759
Merge remote-tracking branch 'origin/main' into swaps/fiat-denominati…
bfullam Jun 16, 2026
d108b9d
fix: resolve merge queue CI failures for release PR
bfullam Jun 16, 2026
be04faa
fix: sync yarn.lock with bridge controller version bumps
bfullam Jun 16, 2026
40b61a6
fix: allow toggle analytics request fields before quote
bfullam Jun 17, 2026
67b352d
fix: allow status validation request params
bfullam Jun 17, 2026
ef25161
Merge remote-tracking branch 'origin/main' into swaps/fiat-denominati…
bfullam Jun 17, 2026
5588db6
chore: bump root monorepo version to 1048.0.0
bfullam Jun 17, 2026
d620621
fix: omit denomination from input changed events
bfullam Jun 19, 2026
cbd4d44
fix: update SSE input changed snapshots
bfullam Jun 19, 2026
15b66bc
Merge remote-tracking branch 'origin/main' into swaps/fiat-denominati…
bfullam Jun 19, 2026
7caef63
chore: remove redundant line
bfullam Jun 19, 2026
7b470bc
Merge remote-tracking branch 'origin/main' into swaps/fiat-denominati…
bfullam Jun 19, 2026
479fb8f
fix: keep release changelog entries unreleased
bfullam Jun 19, 2026
4e6f05e
fix: omit missing denomination analytics field
bfullam Jun 19, 2026
2a5ddbf
fix: update batch sell denomination expectations
bfullam Jun 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/core-monorepo",
"version": "1057.0.0",
"version": "1058.0.0",
"private": true,
"description": "Monorepo for packages shared between MetaMask clients",
"repository": {
Expand Down
10 changes: 9 additions & 1 deletion packages/bridge-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Add persisted input primary denomination state and `Unified SwapBridge Fiat Crypto Toggle Clicked` analytics event support ([#9147](https://github.com/MetaMask/core/pull/9147))
- Add optional `environment_type` property to the `ButtonClicked` unified swap/bridge event context ([#9121](https://github.com/MetaMask/core/pull/9121))

### Changed
Expand All @@ -21,6 +22,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bump `@metamask/transaction-controller` from `^67.1.0` to `^68.1.0` ([#9089](https://github.com/MetaMask/core/pull/9089), [#9177](https://github.com/MetaMask/core/pull/9177), [#9203](https://github.com/MetaMask/core/pull/9203))
- Bump `@metamask/profile-sync-controller` from `^28.1.1` to `^28.2.0` ([#9119](https://github.com/MetaMask/core/pull/9119))

## [75.2.0]

### Added

- Add persisted input primary denomination state and `Unified SwapBridge Fiat Crypto Toggle Clicked` analytics event support ([#9147](https://github.com/MetaMask/core/pull/9147))

## [75.1.1]

### Changed
Expand Down Expand Up @@ -1612,7 +1619,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Initial release ([#5317](https://github.com/MetaMask/core/pull/5317))

[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/bridge-controller@75.1.1...HEAD
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/bridge-controller@75.2.0...HEAD
[75.2.0]: https://github.com/MetaMask/core/compare/@metamask/bridge-controller@75.1.1...@metamask/bridge-controller@75.2.0
[75.1.1]: https://github.com/MetaMask/core/compare/@metamask/bridge-controller@75.1.0...@metamask/bridge-controller@75.1.1
[75.1.0]: https://github.com/MetaMask/core/compare/@metamask/bridge-controller@75.0.0...@metamask/bridge-controller@75.1.0
[75.0.0]: https://github.com/MetaMask/core/compare/@metamask/bridge-controller@74.0.0...@metamask/bridge-controller@75.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/bridge-controller/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/bridge-controller",
"version": "75.1.1",
"version": "75.2.0",
"description": "Manages bridge-related quote fetching functionality for MetaMask",
"keywords": [
"Ethereum",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ exports[`BridgeController BatchSell (multiple quote requests) SSE fetch quotes s
},
"batchSellTrades": null,
"batchSellTradesLoadingStatus": 0,
"inputPrimaryDenomination": "token_amount",
"minimumBalanceForRentExemptionInLamports": "0",
"quoteFetchError": null,
"quoteRequest": [
Expand Down Expand Up @@ -112,6 +113,7 @@ exports[`BridgeController BatchSell (multiple quote requests) SSE fetch quotes s
"custom_slippage": true,
"feature_id": "batch_sell",
"has_sufficient_funds": true,
"input_primary_denomination": "token_amount",
"is_hardware_wallet": false,
"location": "Main View",
"security_warnings": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ exports[`BridgeController SSE should replace all stale quotes after a refresh an
"custom_slippage": true,
"feature_id": "unified_swap_bridge",
"has_sufficient_funds": true,
"input_primary_denomination": "token_amount",
"is_hardware_wallet": false,
"location": "Main View",
"security_warnings": [],
Expand Down Expand Up @@ -105,6 +106,7 @@ exports[`BridgeController SSE should reset and refetch quotes after quote reques
"custom_slippage": true,
"feature_id": "unified_swap_bridge",
"has_sufficient_funds": false,
"input_primary_denomination": "token_amount",
"is_hardware_wallet": false,
"location": "Main View",
"security_warnings": [],
Expand Down Expand Up @@ -134,6 +136,7 @@ exports[`BridgeController SSE should reset quotes list if quote refresh fails 2`
"custom_slippage": true,
"feature_id": "unified_swap_bridge",
"has_sufficient_funds": true,
"input_primary_denomination": "token_amount",
"is_hardware_wallet": false,
"location": "Main View",
"security_warnings": [],
Expand Down Expand Up @@ -188,6 +191,7 @@ exports[`BridgeController SSE should rethrow error from server 1`] = `
},
"batchSellTrades": null,
"batchSellTradesLoadingStatus": null,
"inputPrimaryDenomination": "token_amount",
"minimumBalanceForRentExemptionInLamports": "0",
"quoteFetchError": null,
"quoteRequest": [
Expand Down Expand Up @@ -266,6 +270,7 @@ exports[`BridgeController SSE should rethrow error from server 3`] = `
"custom_slippage": true,
"feature_id": "unified_swap_bridge",
"has_sufficient_funds": true,
"input_primary_denomination": "token_amount",
"is_hardware_wallet": false,
"location": "Main View",
"security_warnings": [],
Expand Down Expand Up @@ -320,6 +325,7 @@ exports[`BridgeController SSE should trigger quote polling if request is valid 1
},
"batchSellTrades": null,
"batchSellTradesLoadingStatus": null,
"inputPrimaryDenomination": "token_amount",
"minimumBalanceForRentExemptionInLamports": "0",
"quoteFetchError": null,
"quoteRequest": [
Expand Down Expand Up @@ -398,6 +404,7 @@ exports[`BridgeController SSE should trigger quote polling if request is valid 2
"custom_slippage": true,
"feature_id": "unified_swap_bridge",
"has_sufficient_funds": true,
"input_primary_denomination": "token_amount",
"is_hardware_wallet": false,
"location": "Main View",
"security_warnings": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ exports[`BridgeController should handle errors from fetchBridgeQuotes 1`] = `
},
"batchSellTrades": null,
"batchSellTradesLoadingStatus": null,
"inputPrimaryDenomination": "token_amount",
"minimumBalanceForRentExemptionInLamports": "0",
"quoteFetchError": null,
"quoteRequest": [
Expand Down Expand Up @@ -43,6 +44,7 @@ exports[`BridgeController should handle errors from fetchBridgeQuotes 2`] = `
},
"batchSellTrades": null,
"batchSellTradesLoadingStatus": null,
"inputPrimaryDenomination": "token_amount",
"minimumBalanceForRentExemptionInLamports": "0",
"quoteFetchError": null,
"quoteRequest": [
Expand Down Expand Up @@ -345,6 +347,29 @@ exports[`BridgeController trackUnifiedSwapBridgeEvent client-side calls should t
]
`;

exports[`BridgeController trackUnifiedSwapBridgeEvent client-side calls should track the FiatCryptoToggleClicked event 1`] = `
[
[
"Unified SwapBridge Fiat Crypto Toggle Clicked",
{
"action_type": "swapbridge-v1",
"chain_id_destination": "eip155:1",
"chain_id_source": "eip155:1",
"feature_id": "quick_buy_follow_trading",
"location": "Main View",
"new_primary_denomination": "fiat_value",
"previous_primary_denomination": "token_amount",
"swap_type": "single_chain",
"token_address_destination": "eip155:1/erc20:0xdAC17F958D2ee523a2206206994597C13D831ec7",
"token_address_source": "eip155:1/slip44:60",
"token_security_type_destination": null,
"token_symbol_destination": "USDC",
"token_symbol_source": "ETH",
},
],
]
`;

exports[`BridgeController trackUnifiedSwapBridgeEvent client-side calls should track the InputSourceDestinationFlipped event 1`] = `
[
[
Expand Down Expand Up @@ -379,6 +404,7 @@ exports[`BridgeController trackUnifiedSwapBridgeEvent client-side calls should t
"chain_id_source": "eip155:1",
"custom_slippage": false,
"feature_id": "quick_buy_token_details",
"input_primary_denomination": "token_amount",
"is_hardware_wallet": false,
"location": "Main View",
"slippage_limit": undefined,
Expand Down Expand Up @@ -454,6 +480,7 @@ exports[`BridgeController trackUnifiedSwapBridgeEvent client-side calls should t
"gas_included_7702": false,
"has_gas_included_quote": false,
"initial_load_time_all_quotes": 0,
"input_primary_denomination": "token_amount",
"is_hardware_wallet": false,
"location": "Main View",
"price_impact": 0,
Expand Down Expand Up @@ -530,6 +557,7 @@ exports[`BridgeController updateBridgeQuoteRequestParams should only poll once i
"custom_slippage": true,
"feature_id": "unified_swap_bridge",
"has_sufficient_funds": false,
"input_primary_denomination": "token_amount",
"is_hardware_wallet": false,
"location": "Main View",
"security_warnings": [],
Expand Down Expand Up @@ -560,6 +588,7 @@ exports[`BridgeController updateBridgeQuoteRequestParams should only poll once i
"gas_included_7702": false,
"has_gas_included_quote": false,
"initial_load_time_all_quotes": 11000,
"input_primary_denomination": "token_amount",
"is_hardware_wallet": false,
"location": "Main View",
"price_impact": 0,
Expand Down Expand Up @@ -854,6 +883,7 @@ exports[`BridgeController updateBridgeQuoteRequestParams should trigger quote po
"assetExchangeRates": {},
"batchSellTrades": null,
"batchSellTradesLoadingStatus": null,
"inputPrimaryDenomination": "token_amount",
"minimumBalanceForRentExemptionInLamports": "0",
"quoteFetchError": null,
"quoteRequest": [
Expand Down Expand Up @@ -891,6 +921,7 @@ exports[`BridgeController updateBridgeQuoteRequestParams should trigger quote po
},
"batchSellTrades": null,
"batchSellTradesLoadingStatus": null,
"inputPrimaryDenomination": "token_amount",
"minimumBalanceForRentExemptionInLamports": "0",
"quoteFetchError": null,
"quoteRequest": [
Expand Down Expand Up @@ -968,6 +999,7 @@ exports[`BridgeController updateBridgeQuoteRequestParams should trigger quote po
"custom_slippage": true,
"feature_id": "unified_swap_bridge",
"has_sufficient_funds": true,
"input_primary_denomination": "token_amount",
"is_hardware_wallet": false,
"location": "Main View",
"security_warnings": [],
Expand All @@ -993,6 +1025,7 @@ exports[`BridgeController updateBridgeQuoteRequestParams should trigger quote po
"custom_slippage": true,
"feature_id": "unified_swap_bridge",
"has_sufficient_funds": true,
"input_primary_denomination": "token_amount",
"is_hardware_wallet": false,
"location": "Main View",
"security_warnings": [],
Expand All @@ -1018,6 +1051,7 @@ exports[`BridgeController updateBridgeQuoteRequestParams should trigger quote po
"custom_slippage": true,
"feature_id": "unified_swap_bridge",
"has_sufficient_funds": true,
"input_primary_denomination": "token_amount",
"is_hardware_wallet": false,
"location": "Main View",
"security_warnings": [],
Expand Down Expand Up @@ -1069,6 +1103,7 @@ exports[`BridgeController updateBridgeQuoteRequestParams should trigger quote po
"custom_slippage": true,
"feature_id": "unified_swap_bridge",
"has_sufficient_funds": true,
"input_primary_denomination": "token_amount",
"is_hardware_wallet": false,
"location": "Main View",
"security_warnings": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ export type BridgeControllerSetLocationAction = {
handler: BridgeController['setLocation'];
};

export type BridgeControllerSetInputPrimaryDenominationAction = {
type: `BridgeController:setInputPrimaryDenomination`;
handler: BridgeController['setInputPrimaryDenomination'];
};

export type BridgeControllerResetStateAction = {
type: `BridgeController:resetState`;
handler: BridgeController['resetState'];
Expand Down Expand Up @@ -53,6 +58,7 @@ export type BridgeControllerMethodActions =
| BridgeControllerFetchQuotesAction
| BridgeControllerStopPollingForQuotesAction
| BridgeControllerSetLocationAction
| BridgeControllerSetInputPrimaryDenominationAction
| BridgeControllerResetStateAction
| BridgeControllerSetChainIntervalLengthAction
| BridgeControllerTrackUnifiedSwapBridgeEventAction
Expand Down
58 changes: 57 additions & 1 deletion packages/bridge-controller/src/bridge-controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3013,6 +3013,56 @@ describe('BridgeController', function () {
});
});

it('should track the FiatCryptoToggleClicked event', async () => {
await withController(async ({ rootMessenger, controller }) => {
jest.spyOn(console, 'warn').mockImplementationOnce(jest.fn());
await rootMessenger.call(
'BridgeController:updateBridgeQuoteRequestParams',
{
walletAddress: '0x123',
},
{
stx_enabled: false,
security_warnings: [],
token_symbol_source: 'ETH',
token_symbol_destination: 'USDC',
usd_amount_source: 100,
token_security_type_destination: null,
feature_id: FeatureId.QUICK_BUY_FOLLOW_TRADING,
},
);
rootMessenger.call(
'BridgeController:setInputPrimaryDenomination',
'fiat_value',
);
expect(controller.state.inputPrimaryDenomination).toBe('fiat_value');
jest.clearAllMocks();
rootMessenger.call(
'BridgeController:trackUnifiedSwapBridgeEvent',
UnifiedSwapBridgeEventName.FiatCryptoToggleClicked,
{
location: MetaMetricsSwapsEventSource.MainView,
previous_primary_denomination: 'token_amount',
new_primary_denomination: 'fiat_value',
token_symbol_source: 'ETH',
token_symbol_destination: 'USDC',
chain_id_source: formatChainIdToCaip(ChainId.ETH),
chain_id_destination: formatChainIdToCaip(ChainId.ETH),
token_address_source: formatAddressToAssetId('', ChainId.ETH),
token_address_destination: formatAddressToAssetId(
ETH_USDT_ADDRESS,
ChainId.ETH,
),
token_security_type_destination: null,
swap_type: MetricsSwapType.SINGLE,
feature_id: FeatureId.QUICK_BUY_FOLLOW_TRADING,
},
);
expect(trackMetaMetricsFn).toHaveBeenCalledTimes(1);
expect(trackMetaMetricsFn.mock.calls).toMatchSnapshot();
});
});

it('should track InputChanged with an enum quick amount preset label', async () => {
await withController(async ({ rootMessenger }) => {
// Ignore console.warn for this test bc there will be expected asset rate fetching warnings
Expand Down Expand Up @@ -4342,6 +4392,7 @@ describe('BridgeController', function () {
"assetExchangeRates": {},
"batchSellTrades": null,
"batchSellTradesLoadingStatus": null,
"inputPrimaryDenomination": "token_amount",
"minimumBalanceForRentExemptionInLamports": "0",
"quoteFetchError": null,
"quoteRequest": [
Expand Down Expand Up @@ -4370,7 +4421,11 @@ describe('BridgeController', function () {
bridgeController.metadata,
'persist',
),
).toMatchInlineSnapshot(`{}`);
).toMatchInlineSnapshot(`
{
"inputPrimaryDenomination": "token_amount",
}
`);
});
});

Expand All @@ -4387,6 +4442,7 @@ describe('BridgeController', function () {
"assetExchangeRates": {},
"batchSellTrades": null,
"batchSellTradesLoadingStatus": null,
"inputPrimaryDenomination": "token_amount",
"minimumBalanceForRentExemptionInLamports": "0",
"quoteFetchError": null,
"quoteRequest": [
Expand Down
Loading
Loading