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