@metamask-previews/bridge-status-controller 66.0.2-preview-ee8f1b28b → 66.0.2-preview-b548d8d
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.
- package/CHANGELOG.md +0 -10
- package/dist/bridge-status-controller.cjs +6 -16
- package/dist/bridge-status-controller.cjs.map +1 -1
- package/dist/bridge-status-controller.d.cts +2 -5
- package/dist/bridge-status-controller.d.cts.map +1 -1
- package/dist/bridge-status-controller.d.mts +2 -5
- package/dist/bridge-status-controller.d.mts.map +1 -1
- package/dist/bridge-status-controller.mjs +7 -17
- package/dist/bridge-status-controller.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +1 -7
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +1 -7
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/metrics.cjs +1 -3
- package/dist/utils/metrics.cjs.map +1 -1
- package/dist/utils/metrics.d.cts +2 -4
- package/dist/utils/metrics.d.cts.map +1 -1
- package/dist/utils/metrics.d.mts +2 -4
- package/dist/utils/metrics.d.mts.map +1 -1
- package/dist/utils/metrics.mjs +2 -4
- package/dist/utils/metrics.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,16 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
### Added
|
|
11
|
-
|
|
12
|
-
- Added `location` property to `BridgeHistoryItem` to persist the entry point across the transaction lifecycle ([#7931](https://github.com/MetaMask/core/pull/7931))
|
|
13
|
-
- Added `location` parameter to `StartPollingForBridgeTxStatusArgs` ([#7931](https://github.com/MetaMask/core/pull/7931))
|
|
14
|
-
- Added optional `location` parameter to `submitTx` method ([#7931](https://github.com/MetaMask/core/pull/7931))
|
|
15
|
-
|
|
16
|
-
### Changed
|
|
17
|
-
|
|
18
|
-
- All post-submission events (`Submitted`, `Completed`, `Failed`, `PollingStatusUpdated`, `StatusValidationFailed`) now include the `location` property from `BridgeHistoryItem` ([#7931](https://github.com/MetaMask/core/pull/7931))
|
|
19
|
-
|
|
20
10
|
### Fixed
|
|
21
11
|
|
|
22
12
|
- Fix `usd_amount_source` default value in EVM transaction metrics properties from `100` to `0` ([#7899](https://github.com/MetaMask/core/pull/7899))
|
|
@@ -207,7 +207,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
207
207
|
});
|
|
208
208
|
});
|
|
209
209
|
_BridgeStatusController_addTxToHistory.set(this, (startPollingForBridgeTxStatusArgs, actionId) => {
|
|
210
|
-
const { bridgeTxMeta, statusRequest, quoteResponse, startTime, slippagePercentage, initialDestAssetBalance, targetContractAddress, approvalTxId, isStxEnabled,
|
|
210
|
+
const { bridgeTxMeta, statusRequest, quoteResponse, startTime, slippagePercentage, initialDestAssetBalance, targetContractAddress, approvalTxId, isStxEnabled, accountAddress: selectedAddress, } = startPollingForBridgeTxStatusArgs;
|
|
211
211
|
// Determine the key for this history item:
|
|
212
212
|
// - For pre-submission (non-batch EVM): use actionId
|
|
213
213
|
// - For post-submission or other cases: use bridgeTxMeta.id
|
|
@@ -247,7 +247,6 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
247
247
|
approvalTxId,
|
|
248
248
|
isStxEnabled: isStxEnabled ?? false,
|
|
249
249
|
featureId: quoteResponse.featureId,
|
|
250
|
-
location,
|
|
251
250
|
};
|
|
252
251
|
this.update((state) => {
|
|
253
252
|
// Use actionId as key for pre-submission, or txMeta.id for post-submission
|
|
@@ -407,7 +406,6 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
407
406
|
if (validationFailures.length > 0) {
|
|
408
407
|
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.StatusValidationFailed, bridgeTxMetaId, {
|
|
409
408
|
failures: validationFailures,
|
|
410
|
-
refresh_count: historyItem.attempts?.counter ?? 0,
|
|
411
409
|
});
|
|
412
410
|
throw new Error(`Bridge status validation failed: ${validationFailures.join(', ')}`);
|
|
413
411
|
}
|
|
@@ -703,10 +701,9 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
703
701
|
* @param quoteResponse - The quote response
|
|
704
702
|
* @param isStxEnabledOnClient - Whether smart transactions are enabled on the client, for example the getSmartTransactionsEnabled selector value from the extension
|
|
705
703
|
* @param quotesReceivedContext - The context for the QuotesReceived event
|
|
706
|
-
* @param location - The entry point from which the user initiated the swap or bridge (e.g. Main View, Token View, Trending Explore)
|
|
707
704
|
* @returns The transaction meta
|
|
708
705
|
*/
|
|
709
|
-
this.submitTx = async (accountAddress, quoteResponse, isStxEnabledOnClient, quotesReceivedContext
|
|
706
|
+
this.submitTx = async (accountAddress, quoteResponse, isStxEnabledOnClient, quotesReceivedContext) => {
|
|
710
707
|
this.messenger.call('BridgeController:stopPollingForQuotes', bridge_controller_1.AbortReason.TransactionSubmitted,
|
|
711
708
|
// If trade is submitted before all quotes are loaded, the QuotesReceived event is published
|
|
712
709
|
// 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
|
|
@@ -716,7 +713,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
716
713
|
throw new Error('Failed to submit cross-chain swap transaction: undefined multichain account');
|
|
717
714
|
}
|
|
718
715
|
const isHardwareAccount = (0, bridge_controller_1.isHardwareWallet)(selectedAccount);
|
|
719
|
-
const preConfirmationProperties = (0, metrics_1.getPreConfirmationPropertiesFromQuote)(quoteResponse, isStxEnabledOnClient, isHardwareAccount
|
|
716
|
+
const preConfirmationProperties = (0, metrics_1.getPreConfirmationPropertiesFromQuote)(quoteResponse, isStxEnabledOnClient, isHardwareAccount);
|
|
720
717
|
// Emit Submitted event after submit button is clicked
|
|
721
718
|
!quoteResponse.featureId &&
|
|
722
719
|
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Submitted, undefined, preConfirmationProperties);
|
|
@@ -837,7 +834,6 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
837
834
|
isStxEnabled: isStxEnabledOnClient,
|
|
838
835
|
startTime,
|
|
839
836
|
approvalTxId,
|
|
840
|
-
location,
|
|
841
837
|
}, actionId);
|
|
842
838
|
// Pass txFee when gasIncluded is true to use the quote's gas fees
|
|
843
839
|
// instead of re-estimating (which would fail for max native token swaps)
|
|
@@ -877,7 +873,6 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
877
873
|
isStxEnabled: isStxEnabledOnClient,
|
|
878
874
|
startTime,
|
|
879
875
|
approvalTxId,
|
|
880
|
-
location,
|
|
881
876
|
});
|
|
882
877
|
}
|
|
883
878
|
if ((0, bridge_controller_1.isNonEvmChainId)(quoteResponse.quote.srcChainId)) {
|
|
@@ -902,16 +897,15 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
902
897
|
* @param params.quoteResponse - Quote carrying intent data
|
|
903
898
|
* @param params.signature - Hex signature produced by eth_signTypedData_v4
|
|
904
899
|
* @param params.accountAddress - The EOA submitting the order
|
|
905
|
-
* @param params.location - The entry point from which the user initiated the swap or bridge
|
|
906
900
|
* @returns A lightweight TransactionMeta-like object for history linking
|
|
907
901
|
*/
|
|
908
902
|
this.submitIntent = async (params) => {
|
|
909
|
-
const { quoteResponse, signature, accountAddress
|
|
903
|
+
const { quoteResponse, signature, accountAddress } = params;
|
|
910
904
|
this.messenger.call('BridgeController:stopPollingForQuotes', bridge_controller_1.AbortReason.TransactionSubmitted);
|
|
911
905
|
// Build pre-confirmation properties for error tracking parity with submitTx
|
|
912
906
|
const account = __classPrivateFieldGet(this, _BridgeStatusController_instances, "m", _BridgeStatusController_getMultichainSelectedAccount).call(this, accountAddress);
|
|
913
907
|
const isHardwareAccount = Boolean(account) && (0, bridge_controller_1.isHardwareWallet)(account);
|
|
914
|
-
const preConfirmationProperties = (0, metrics_1.getPreConfirmationPropertiesFromQuote)(quoteResponse, false, isHardwareAccount
|
|
908
|
+
const preConfirmationProperties = (0, metrics_1.getPreConfirmationPropertiesFromQuote)(quoteResponse, false, isHardwareAccount);
|
|
915
909
|
try {
|
|
916
910
|
const intent = (0, transaction_1.getIntentFromQuote)(quoteResponse);
|
|
917
911
|
// If backend provided an approval tx for this intent quote, submit it first (on-chain),
|
|
@@ -1006,7 +1000,6 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
1006
1000
|
isStxEnabled: false,
|
|
1007
1001
|
approvalTxId,
|
|
1008
1002
|
startTime,
|
|
1009
|
-
location,
|
|
1010
1003
|
});
|
|
1011
1004
|
// Start polling using the orderId key to route to intent manager
|
|
1012
1005
|
__classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this, bridgeHistoryKey);
|
|
@@ -1035,9 +1028,6 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
1035
1028
|
_BridgeStatusController_trackUnifiedSwapBridgeEvent.set(this, (eventName, txMetaId, eventProperties) => {
|
|
1036
1029
|
const baseProperties = {
|
|
1037
1030
|
action_type: bridge_controller_1.MetricsActionType.SWAPBRIDGE_V1,
|
|
1038
|
-
location: eventProperties?.location ??
|
|
1039
|
-
(txMetaId ? this.state.txHistory?.[txMetaId]?.location : undefined) ??
|
|
1040
|
-
bridge_controller_1.MetaMetricsSwapsEventSource.MainView,
|
|
1041
1031
|
...(eventProperties ?? {}),
|
|
1042
1032
|
};
|
|
1043
1033
|
// This will publish events for PERPS dropped tx failures as well
|
|
@@ -1047,7 +1037,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
1047
1037
|
}
|
|
1048
1038
|
const historyItem = this.state.txHistory[txMetaId];
|
|
1049
1039
|
if (!historyItem) {
|
|
1050
|
-
this.messenger.call('BridgeController:trackUnifiedSwapBridgeEvent', eventName,
|
|
1040
|
+
this.messenger.call('BridgeController:trackUnifiedSwapBridgeEvent', eventName, eventProperties ?? {});
|
|
1051
1041
|
return;
|
|
1052
1042
|
}
|
|
1053
1043
|
const requestParamProperties = (0, metrics_1.getRequestParamFromHistory)(historyItem);
|