Skip to content
Draft
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
2ee6619
feat: implement new submission flows
micaelae Mar 19, 2026
f6ec410
feat: use submission flows in controller
micaelae Mar 19, 2026
ba94710
chore: rename
micaelae Mar 23, 2026
761a5ee
fix: comments
micaelae Apr 7, 2026
e97bc41
chore: move tx data validation
micaelae Apr 7, 2026
8f243cc
chore: specify history keys
micaelae Apr 7, 2026
babd6f6
refactor: gasless params
micaelae Apr 7, 2026
d709ae9
fix: unit tests
micaelae Apr 9, 2026
cc89a81
Merge branch 'main' into swaps4229-submitTx-strategy-refactor
micaelae Apr 9, 2026
ff4e75c
fix: lint error
micaelae Apr 9, 2026
5b79bb8
chore: changelog
micaelae Apr 9, 2026
9138a00
Merge branch 'main' into swaps4229-submitTx-strategy-refactor
micaelae May 7, 2026
67d46d8
fix: lint
micaelae May 7, 2026
7db8bc0
fix: trace intent approvals
micaelae May 7, 2026
f6a555f
chore: test coverage
micaelae May 7, 2026
68d5ab3
refactor: featureId
micaelae May 8, 2026
8fa9139
chore: update types
micaelae May 8, 2026
b42456d
Merge branch 'main' into swaps4229-submitTx-strategy-refactor
micaelae May 13, 2026
843ae4b
fix: lint
micaelae May 19, 2026
860eb93
Merge branch 'main' into swaps4229-submitTx-strategy-refactor
micaelae May 19, 2026
290820e
Merge branch 'main' into swaps4229-submitTx-strategy-refactor
micaelae May 19, 2026
73fc2da
Merge branch 'main' into swaps4229-submitTx-strategy-refactor
micaelae May 20, 2026
80c987c
Merge branch 'main' into swaps4229-submitTx-strategy-refactor
micaelae May 22, 2026
db17b37
Merge branch 'main' into swaps4229-submitTx-strategy-refactor
micaelae May 22, 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
5 changes: 0 additions & 5 deletions eslint-suppressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -740,11 +740,6 @@
"count": 3
}
},
"packages/bridge-status-controller/src/utils/transaction.ts": {
"no-restricted-syntax": {
"count": 4
}
},
"packages/chain-agnostic-permission/src/caip25Permission.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 11
Expand Down
1 change: 1 addition & 0 deletions packages/bridge-status-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

### Changed

- Refactor tx submission into strategies to reduce quote-specific branching in the controller, and to de-duplicate shared logic between `submitTx` and `submitIntent`. Each strategy yields payloads that the controller uses to update history, poll, and publish metrics ([#8257](https://github.com/MetaMask/core/pull/8257))
- Bump `@metamask/bridge-controller` from `^72.0.4` to `^73.0.1` ([#8850](https://github.com/MetaMask/core/pull/8850), [#8866](https://github.com/MetaMask/core/pull/8866))
- Remove unnecessary type assertions for bridge quotes ([#8805](https://github.com/MetaMask/core/pull/8805))

Expand Down
7 changes: 6 additions & 1 deletion packages/bridge-status-controller/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ module.exports = merge(baseConfig, {

coverageProvider: 'v8',

coveragePathIgnorePatterns: ['.*/index\\.ts', '.*-method-action-types\\.ts'],
coveragePathIgnorePatterns: [
...baseConfig.coveragePathIgnorePatterns,
'.*/strategy/types\\.ts$',
'.*/index\\.ts',
'.*-method-action-types\\.ts',
],

// An object that configures minimum threshold enforcement for coverage results
coverageThreshold: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ exports[`BridgeStatusController constructor rehydrates the tx history state 1`]
"hasApprovalTx": false,
"initialDestAssetBalance": undefined,
"isStxEnabled": false,
"location": undefined,
"location": "Main View",
"originalTransactionId": "bridgeTxMetaId1",
"pricingData": {
"amountSent": "1.234",
Expand Down Expand Up @@ -269,7 +269,7 @@ exports[`BridgeStatusController startPollingForBridgeTxStatus sets the inital tx
"hasApprovalTx": false,
"initialDestAssetBalance": undefined,
"isStxEnabled": false,
"location": undefined,
"location": "Main View",
"originalTransactionId": "bridgeTxMetaId1",
"pricingData": {
"amountSent": "1.234",
Expand Down Expand Up @@ -4002,6 +4002,7 @@ exports[`BridgeStatusController submitTx: EVM swap should handle smart transacti
"requireApproval": false,
"transactions": [
{
"assetsFiatValues": undefined,
"params": {
"data": "0xapprovalData",
"from": "0xaccount1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,7 @@ describe('BridgeStatusController (intent swaps)', () => {
"chainId": "0x1",
"hash": undefined,
"id": "intentDisplayTxId1",
"isIntentTx": true,
"networkClientId": "network-client-id-1",
"orderUid": "order-uid-approve-1",
"status": "submitted",
"time": 1773879217428,
"txParams": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
FeatureId,
getQuotesReceivedProperties,
UnifiedSwapBridgeEventName,
MetaMetricsSwapsEventSource,
} from '@metamask/bridge-controller';
import { Messenger, MOCK_ANY_NAMESPACE } from '@metamask/messenger';
import type {
Expand Down Expand Up @@ -56,6 +57,7 @@ import type {
} from './types';
import * as bridgeStatusUtils from './utils/bridge-status';
import * as historyUtils from './utils/history';
import * as metricsUtils from './utils/metrics';
import * as transactionUtils from './utils/transaction';

type AllBridgeStatusControllerActions =
Expand Down Expand Up @@ -332,6 +334,7 @@ const getMockStartPollingForBridgeTxStatusArgs = ({
initialDestAssetBalance: undefined,
targetContractAddress: '0x23981fC34e69eeDFE2BD9a0a9fCb0719Fe09DbFC',
isStxEnabled,
location: MetaMetricsSwapsEventSource.MainView,
});

const MockTxHistory = {
Expand Down Expand Up @@ -432,7 +435,7 @@ const MockTxHistory = {
completionTime: undefined,
attempts,
featureId,
location: undefined,
location: MetaMetricsSwapsEventSource.MainView,
},
}),
getUnknown: ({
Expand Down Expand Up @@ -547,7 +550,7 @@ const MockTxHistory = {
isStxEnabled: true,
hasApprovalTx: false,
attempts: undefined,
location: undefined,
location: MetaMetricsSwapsEventSource.MainView,
},
}),
};
Expand Down Expand Up @@ -5100,6 +5103,81 @@ describe('BridgeStatusController', () => {
expect(messengerCallSpy.mock.lastCall).toMatchSnapshot();
});

it('should use txMeta properties if history item does not exist', () => {
const messengerCallSpy = jest.spyOn(mockBridgeStatusMessenger, 'call');

const transactionMeta = {
error: { name: 'Error', message: 'tx-error' },
chainId: CHAIN_IDS.ARBITRUM,
networkClientId: 'eth-id',
time: Date.now(),
txParams: {} as unknown as TransactionParams,
type: TransactionType.bridge,
status: TransactionStatus.failed,
id: 'bridgeTxMetaId1',
};
const getEVMTxPropertiesFromTransactionMetaSpy = jest
.spyOn(metricsUtils, 'getEVMTxPropertiesFromTransactionMeta')
.mockImplementationOnce(() => {
bridgeStatusController.wipeBridgeStatus({
address: 'otherAccount',
ignoreNetwork: true,
});
return metricsUtils.getEVMTxPropertiesFromTransactionMeta(
transactionMeta,
);
});
mockMessenger.publish(
'TransactionController:transactionStatusUpdated',
{
transactionMeta,
},
);

expect(getEVMTxPropertiesFromTransactionMetaSpy).toHaveBeenCalledTimes(
2,
);
expect(bridgeStatusController.state.txHistory).toStrictEqual({});
expect(messengerCallSpy.mock.lastCall).toMatchInlineSnapshot(`
[
"BridgeController:trackUnifiedSwapBridgeEvent",
"Unified SwapBridge Failed",
{
"account_hardware_type": null,
"action_type": "swapbridge-v1",
"actual_time_minutes": 0,
"chain_id_destination": "eip155:42161",
"chain_id_source": "eip155:42161",
"custom_slippage": false,
"error_message": "Transaction failed. tx-error",
"gas_included": false,
"gas_included_7702": false,
"is_hardware_wallet": false,
"location": "Main View",
"price_impact": 0,
"provider": "",
"quote_vs_execution_ratio": 0,
"quoted_time_minutes": 0,
"quoted_vs_used_gas_ratio": 0,
"security_warnings": [],
"source_transaction": "FAILED",
"stx_enabled": false,
"swap_type": "crosschain",
"token_address_destination": "eip155:42161/slip44:60",
"token_address_source": "eip155:42161/slip44:60",
"token_security_type_destination": null,
"token_symbol_destination": "",
"token_symbol_source": "",
"usd_actual_gas": 0,
"usd_actual_return": 0,
"usd_amount_source": 0,
"usd_quoted_gas": 0,
"usd_quoted_return": 0,
},
]
`);
});

it('should include ab_tests and active_ab_tests from history in tracked event properties', () => {
const abTestsTxMetaId = 'bridgeTxMetaIdAbTests';
mockMessenger.call(
Expand Down
Loading
Loading