@metamask-previews/bridge-status-controller 68.0.0-preview-384cfdfef → 68.0.1-preview-00245ea

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -205,7 +205,7 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
205
205
  });
206
206
  });
207
207
  _BridgeStatusController_addTxToHistory.set(this, (startPollingForBridgeTxStatusArgs, actionId) => {
208
- const { bridgeTxMeta, statusRequest, quoteResponse, startTime, slippagePercentage, initialDestAssetBalance, targetContractAddress, approvalTxId, isStxEnabled, location, abTests, activeAbTests, accountAddress: selectedAddress, } = startPollingForBridgeTxStatusArgs;
208
+ const { bridgeTxMeta, statusRequest, quoteResponse, startTime, slippagePercentage, initialDestAssetBalance, targetContractAddress, approvalTxId, isStxEnabled, location, abTests, accountAddress: selectedAddress, } = startPollingForBridgeTxStatusArgs;
209
209
  // Determine the key for this history item:
210
210
  // - For pre-submission (non-batch EVM): use actionId
211
211
  // - For post-submission or other cases: use bridgeTxMeta.id
@@ -247,7 +247,6 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
247
247
  featureId: quoteResponse.featureId,
248
248
  location,
249
249
  ...(abTests && { abTests }),
250
- ...(activeAbTests && { activeAbTests }),
251
250
  };
252
251
  this.update((state) => {
253
252
  // Use actionId as key for pre-submission, or txMeta.id for post-submission
@@ -712,11 +711,10 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
712
711
  * @param isStxEnabledOnClient - Whether smart transactions are enabled on the client, for example the getSmartTransactionsEnabled selector value from the extension
713
712
  * @param quotesReceivedContext - The context for the QuotesReceived event
714
713
  * @param location - The entry point from which the user initiated the swap or bridge (e.g. Main View, Token View, Trending Explore)
715
- * @param abTests - Legacy A/B test context for `ab_tests` (backward compatibility)
716
- * @param activeAbTests - New A/B test context for `active_ab_tests` (migration target). Attributes events to specific experiments.
714
+ * @param abTests - A/B test context to attribute events to specific experiments
717
715
  * @returns The transaction meta
718
716
  */
719
- this.submitTx = async (accountAddress, quoteResponse, isStxEnabledOnClient, quotesReceivedContext, location = MetaMetricsSwapsEventSource.MainView, abTests, activeAbTests) => {
717
+ this.submitTx = async (accountAddress, quoteResponse, isStxEnabledOnClient, quotesReceivedContext, location = MetaMetricsSwapsEventSource.MainView, abTests) => {
720
718
  this.messenger.call('BridgeController:stopPollingForQuotes', AbortReason.TransactionSubmitted,
721
719
  // If trade is submitted before all quotes are loaded, the QuotesReceived event is published
722
720
  // If the trade has a featureId, it means it was submitted outside of the Unified Swap and Bridge experience, so no QuotesReceived event is published
@@ -726,7 +724,7 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
726
724
  throw new Error('Failed to submit cross-chain swap transaction: undefined multichain account');
727
725
  }
728
726
  const isHardwareAccount = isHardwareWallet(selectedAccount);
729
- const preConfirmationProperties = getPreConfirmationPropertiesFromQuote(quoteResponse, isStxEnabledOnClient, isHardwareAccount, location, abTests, activeAbTests);
727
+ const preConfirmationProperties = getPreConfirmationPropertiesFromQuote(quoteResponse, isStxEnabledOnClient, isHardwareAccount, location, abTests);
730
728
  // Emit Submitted event after submit button is clicked
731
729
  !quoteResponse.featureId &&
732
730
  __classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, UnifiedSwapBridgeEventName.Submitted, undefined, preConfirmationProperties);
@@ -849,7 +847,6 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
849
847
  approvalTxId,
850
848
  location,
851
849
  abTests,
852
- activeAbTests,
853
850
  }, actionId);
854
851
  // Pass txFee when gasIncluded is true to use the quote's gas fees
855
852
  // instead of re-estimating (which would fail for max native token swaps)
@@ -891,7 +888,6 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
891
888
  approvalTxId,
892
889
  location,
893
890
  abTests,
894
- activeAbTests,
895
891
  });
896
892
  }
897
893
  if (isNonEvmChainId(quoteResponse.quote.srcChainId)) {
@@ -916,17 +912,16 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
916
912
  * @param params.quoteResponse - Quote carrying intent data
917
913
  * @param params.accountAddress - The EOA submitting the order
918
914
  * @param params.location - The entry point from which the user initiated the swap or bridge
919
- * @param params.abTests - Legacy A/B test context for `ab_tests` (backward compatibility)
920
- * @param params.activeAbTests - New A/B test context for `active_ab_tests` (migration target). Attributes events to specific experiments.
915
+ * @param params.abTests - A/B test context to attribute events to specific experiments
921
916
  * @returns A lightweight TransactionMeta-like object for history linking
922
917
  */
923
918
  this.submitIntent = async (params) => {
924
- const { quoteResponse, accountAddress, location, abTests, activeAbTests } = params;
919
+ const { quoteResponse, accountAddress, location, abTests } = params;
925
920
  this.messenger.call('BridgeController:stopPollingForQuotes', AbortReason.TransactionSubmitted);
926
921
  // Build pre-confirmation properties for error tracking parity with submitTx
927
922
  const account = __classPrivateFieldGet(this, _BridgeStatusController_instances, "m", _BridgeStatusController_getMultichainSelectedAccount).call(this, accountAddress);
928
923
  const isHardwareAccount = Boolean(account) && isHardwareWallet(account);
929
- const preConfirmationProperties = getPreConfirmationPropertiesFromQuote(quoteResponse, false, isHardwareAccount, location, abTests, activeAbTests);
924
+ const preConfirmationProperties = getPreConfirmationPropertiesFromQuote(quoteResponse, false, isHardwareAccount, location, abTests);
930
925
  try {
931
926
  const intent = getIntentFromQuote(quoteResponse);
932
927
  // If backend provided an approval tx for this intent quote, submit it first (on-chain),
@@ -1026,7 +1021,6 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
1026
1021
  startTime,
1027
1022
  location,
1028
1023
  abTests,
1029
- activeAbTests,
1030
1024
  });
1031
1025
  // Start polling using the orderId key to route to intent manager
1032
1026
  __classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this, bridgeHistoryKey);
@@ -1053,15 +1047,11 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
1053
1047
  * @param eventProperties - The properties for the event
1054
1048
  */
1055
1049
  _BridgeStatusController_trackUnifiedSwapBridgeEvent.set(this, (eventName, txMetaId, eventProperties) => {
1056
- // Legacy/new metrics fields are intentionally kept independent during migration.
1050
+ const { ab_tests: eventAbTests } = eventProperties ?? {};
1057
1051
  const historyAbTests = txMetaId
1058
1052
  ? this.state.txHistory?.[txMetaId]?.abTests
1059
1053
  : undefined;
1060
- const historyActiveAbTests = txMetaId
1061
- ? this.state.txHistory?.[txMetaId]?.activeAbTests
1062
- : undefined;
1063
- const resolvedAbTests = eventProperties?.ab_tests ?? historyAbTests;
1064
- const resolvedActiveAbTests = eventProperties?.active_ab_tests ?? historyActiveAbTests;
1054
+ const resolvedAbTests = eventAbTests ?? historyAbTests ?? undefined;
1065
1055
  const baseProperties = {
1066
1056
  action_type: MetricsActionType.SWAPBRIDGE_V1,
1067
1057
  location: eventProperties?.location ??
@@ -1072,10 +1062,6 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
1072
1062
  Object.keys(resolvedAbTests).length > 0 && {
1073
1063
  ab_tests: resolvedAbTests,
1074
1064
  }),
1075
- ...(resolvedActiveAbTests &&
1076
- Object.keys(resolvedActiveAbTests).length > 0 && {
1077
- active_ab_tests: resolvedActiveAbTests,
1078
- }),
1079
1065
  };
1080
1066
  // This will publish events for PERPS dropped tx failures as well
1081
1067
  if (!txMetaId) {