@metamask/bridge-status-controller 63.0.0 → 63.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 +24 -1
- package/dist/bridge-status-controller.cjs +42 -45
- package/dist/bridge-status-controller.cjs.map +1 -1
- package/dist/bridge-status-controller.d.cts +4 -5
- package/dist/bridge-status-controller.d.cts.map +1 -1
- package/dist/bridge-status-controller.d.mts +4 -5
- package/dist/bridge-status-controller.d.mts.map +1 -1
- package/dist/bridge-status-controller.mjs +7 -10
- package/dist/bridge-status-controller.mjs.map +1 -1
- package/dist/utils/transaction.d.cts +1 -0
- package/dist/utils/transaction.d.cts.map +1 -1
- package/dist/utils/transaction.d.mts +1 -0
- package/dist/utils/transaction.d.mts.map +1 -1
- package/package.json +7 -15
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
|
+
## [63.1.0]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Bump `@metamask/bridge-controller` from `^63.1.0` to `^63.2.0` ([#7245](https://github.com/MetaMask/core/pull/7245))
|
|
15
|
+
- Move peer dependencies for controller and service packages to direct dependencies ([#7209](https://github.com/MetaMask/core/pull/7209), [#7220](https://github.com/MetaMask/core/pull/7220), [#7236](https://github.com/MetaMask/core/pull/7236))
|
|
16
|
+
- The dependencies moved are:
|
|
17
|
+
- `@metamask/accounts-controller` (^35.0.0)
|
|
18
|
+
- `@metamask/bridge-controller` (^63.0.0)
|
|
19
|
+
- `@metamask/gas-fee-controller` (^26.0.0)
|
|
20
|
+
- `@metamask/network-controller` (^26.0.0)
|
|
21
|
+
- `@metamask/snaps-controllers` (^14.0.1)
|
|
22
|
+
- `@metamask/transaction-controller` (^62.3.0)
|
|
23
|
+
- In clients, it is now possible for multiple versions of these packages to exist in the dependency tree.
|
|
24
|
+
- For example, this scenario would be valid: a client relies on `@metamask/controller-a` 1.0.0 and `@metamask/controller-b` 1.0.0, and `@metamask/controller-b` depends on `@metamask/controller-a` 1.1.0.
|
|
25
|
+
- Note, however, that the versions specified in the client's `package.json` always "win", and you are expected to keep them up to date so as not to break controller and service intercommunication.
|
|
26
|
+
- Bump `@metamask/bridge-controller` from `^63.0.0` to `^63.1.0` ([#7238](https://github.com/MetaMask/core/pull/7238))
|
|
27
|
+
|
|
28
|
+
### Removed
|
|
29
|
+
|
|
30
|
+
- Remove direct QuotesReceived event publishing to avoid race conditions that can happen when clients navigate and reset state. Update `submitTx` to accept quotesReceivedContext (replace isLoading/warnings) and propagate context to the BridgeController through the `stopPollingForQuotes call ([#7242](https://github.com/MetaMask/core/pull/7242))
|
|
31
|
+
|
|
10
32
|
## [63.0.0]
|
|
11
33
|
|
|
12
34
|
### Changed
|
|
@@ -777,7 +799,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
777
799
|
|
|
778
800
|
- Initial release ([#5317](https://github.com/MetaMask/core/pull/5317))
|
|
779
801
|
|
|
780
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@63.
|
|
802
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@63.1.0...HEAD
|
|
803
|
+
[63.1.0]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@63.0.0...@metamask/bridge-status-controller@63.1.0
|
|
781
804
|
[63.0.0]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@62.0.0...@metamask/bridge-status-controller@63.0.0
|
|
782
805
|
[62.0.0]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@61.0.0...@metamask/bridge-status-controller@62.0.0
|
|
783
806
|
[61.0.0]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@60.1.0...@metamask/bridge-status-controller@61.0.0
|
|
@@ -14,7 +14,6 @@ var _BridgeStatusController_instances, _BridgeStatusController_pollingTokensByTx
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.BridgeStatusController = void 0;
|
|
16
16
|
const bridge_controller_1 = require("@metamask/bridge-controller");
|
|
17
|
-
const bridge_controller_2 = require("@metamask/bridge-controller");
|
|
18
17
|
const controller_utils_1 = require("@metamask/controller-utils");
|
|
19
18
|
const polling_controller_1 = require("@metamask/polling-controller");
|
|
20
19
|
const transaction_controller_1 = require("@metamask/transaction-controller");
|
|
@@ -66,7 +65,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
66
65
|
return;
|
|
67
66
|
}
|
|
68
67
|
this.update((statusState) => {
|
|
69
|
-
statusState.txHistory[txHistoryKey].status.status =
|
|
68
|
+
statusState.txHistory[txHistoryKey].status.status = bridge_controller_1.StatusTypes.FAILED;
|
|
70
69
|
});
|
|
71
70
|
});
|
|
72
71
|
this.resetState = () => {
|
|
@@ -124,7 +123,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
124
123
|
}
|
|
125
124
|
});
|
|
126
125
|
// Restart polling if it was stopped and this is a bridge transaction
|
|
127
|
-
const isBridgeTx = (0,
|
|
126
|
+
const isBridgeTx = (0, bridge_controller_1.isCrossChain)(historyItem.quote.srcChainId, historyItem.quote.destChainId);
|
|
128
127
|
if (isBridgeTx) {
|
|
129
128
|
// Check if polling was stopped (no active polling token)
|
|
130
129
|
const existingPollingToken = __classPrivateFieldGet(this, _BridgeStatusController_pollingTokensByTxMetaId, "f")[targetTxMetaId];
|
|
@@ -152,8 +151,8 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
152
151
|
const { txHistory } = this.state;
|
|
153
152
|
const historyItems = Object.values(txHistory);
|
|
154
153
|
const incompleteHistoryItems = historyItems
|
|
155
|
-
.filter((historyItem) => historyItem.status.status ===
|
|
156
|
-
historyItem.status.status ===
|
|
154
|
+
.filter((historyItem) => historyItem.status.status === bridge_controller_1.StatusTypes.PENDING ||
|
|
155
|
+
historyItem.status.status === bridge_controller_1.StatusTypes.UNKNOWN)
|
|
157
156
|
.filter((historyItem) => {
|
|
158
157
|
// Check if we are already polling this tx, if so, skip restarting polling for that
|
|
159
158
|
const pollingToken = __classPrivateFieldGet(this, _BridgeStatusController_pollingTokensByTxMetaId, "f")[historyItem.txMetaId];
|
|
@@ -161,7 +160,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
161
160
|
})
|
|
162
161
|
// Swap txs don't need to have their statuses polled
|
|
163
162
|
.filter((historyItem) => {
|
|
164
|
-
const isBridgeTx = (0,
|
|
163
|
+
const isBridgeTx = (0, bridge_controller_1.isCrossChain)(historyItem.quote.srcChainId, historyItem.quote.destChainId);
|
|
165
164
|
return isBridgeTx;
|
|
166
165
|
});
|
|
167
166
|
incompleteHistoryItems.forEach((historyItem) => {
|
|
@@ -199,7 +198,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
199
198
|
status: {
|
|
200
199
|
// We always have a PENDING status when we start polling for a tx, don't need the Bridge API for that
|
|
201
200
|
// Also we know the bare minimum fields for status at this point in time
|
|
202
|
-
status:
|
|
201
|
+
status: bridge_controller_1.StatusTypes.PENDING,
|
|
203
202
|
srcChain: {
|
|
204
203
|
chainId: statusRequest.srcChainId,
|
|
205
204
|
txHash: statusRequest.srcTxHash,
|
|
@@ -226,7 +225,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
226
225
|
return;
|
|
227
226
|
}
|
|
228
227
|
const { quote } = txHistoryItem;
|
|
229
|
-
const isBridgeTx = (0,
|
|
228
|
+
const isBridgeTx = (0, bridge_controller_1.isCrossChain)(quote.srcChainId, quote.destChainId);
|
|
230
229
|
if (isBridgeTx) {
|
|
231
230
|
__classPrivateFieldGet(this, _BridgeStatusController_pollingTokensByTxMetaId, "f")[txId] = this.startPolling({
|
|
232
231
|
bridgeTxMetaId: txId,
|
|
@@ -302,7 +301,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
302
301
|
const statusRequest = (0, bridge_status_1.getStatusRequestWithSrcTxHash)(historyItem.quote, srcTxHash);
|
|
303
302
|
const { status, validationFailures } = await (0, bridge_status_1.fetchBridgeTxStatus)(statusRequest, __classPrivateFieldGet(this, _BridgeStatusController_clientId, "f"), __classPrivateFieldGet(this, _BridgeStatusController_fetchFn, "f"), __classPrivateFieldGet(this, _BridgeStatusController_config, "f").customBridgeApiBaseUrl);
|
|
304
303
|
if (validationFailures.length > 0) {
|
|
305
|
-
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this,
|
|
304
|
+
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.StatusValidationFailed, bridgeTxMetaId, {
|
|
306
305
|
failures: validationFailures,
|
|
307
306
|
});
|
|
308
307
|
throw new Error(`Bridge status validation failed: ${validationFailures.join(', ')}`);
|
|
@@ -310,8 +309,8 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
310
309
|
const newBridgeHistoryItem = {
|
|
311
310
|
...historyItem,
|
|
312
311
|
status,
|
|
313
|
-
completionTime: status.status ===
|
|
314
|
-
status.status ===
|
|
312
|
+
completionTime: status.status === bridge_controller_1.StatusTypes.COMPLETE ||
|
|
313
|
+
status.status === bridge_controller_1.StatusTypes.FAILED
|
|
315
314
|
? Date.now()
|
|
316
315
|
: undefined, // TODO make this more accurate by looking up dest txHash block time
|
|
317
316
|
attempts: undefined,
|
|
@@ -324,8 +323,8 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
324
323
|
state.txHistory[bridgeTxMetaId] = newBridgeHistoryItem;
|
|
325
324
|
});
|
|
326
325
|
const pollingToken = __classPrivateFieldGet(this, _BridgeStatusController_pollingTokensByTxMetaId, "f")[bridgeTxMetaId];
|
|
327
|
-
const isFinalStatus = status.status ===
|
|
328
|
-
status.status ===
|
|
326
|
+
const isFinalStatus = status.status === bridge_controller_1.StatusTypes.COMPLETE ||
|
|
327
|
+
status.status === bridge_controller_1.StatusTypes.FAILED;
|
|
329
328
|
if (isFinalStatus && pollingToken) {
|
|
330
329
|
this.stopPollingByPollingToken(pollingToken);
|
|
331
330
|
delete __classPrivateFieldGet(this, _BridgeStatusController_pollingTokensByTxMetaId, "f")[bridgeTxMetaId];
|
|
@@ -333,12 +332,12 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
333
332
|
if (historyItem.featureId) {
|
|
334
333
|
return;
|
|
335
334
|
}
|
|
336
|
-
if (status.status ===
|
|
337
|
-
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this,
|
|
335
|
+
if (status.status === bridge_controller_1.StatusTypes.COMPLETE) {
|
|
336
|
+
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Completed, bridgeTxMetaId);
|
|
338
337
|
this.messenger.publish('BridgeStatusController:destinationTransactionCompleted', historyItem.quote.destAsset.assetId);
|
|
339
338
|
}
|
|
340
|
-
if (status.status ===
|
|
341
|
-
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this,
|
|
339
|
+
if (status.status === bridge_controller_1.StatusTypes.FAILED) {
|
|
340
|
+
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Failed, bridgeTxMetaId);
|
|
342
341
|
}
|
|
343
342
|
}
|
|
344
343
|
}
|
|
@@ -454,7 +453,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
454
453
|
? constants_1.TraceName.BridgeTransactionApprovalCompleted
|
|
455
454
|
: constants_1.TraceName.SwapTransactionApprovalCompleted,
|
|
456
455
|
data: {
|
|
457
|
-
srcChainId: (0,
|
|
456
|
+
srcChainId: (0, bridge_controller_1.formatChainIdToCaip)(quoteResponse.quote.srcChainId),
|
|
458
457
|
stxEnabled: false,
|
|
459
458
|
},
|
|
460
459
|
}, approveTx);
|
|
@@ -476,7 +475,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
476
475
|
if (!selectedAccount) {
|
|
477
476
|
throw new Error('Failed to submit cross-chain swap transaction: unknown account in trade data');
|
|
478
477
|
}
|
|
479
|
-
const hexChainId = (0,
|
|
478
|
+
const hexChainId = (0, bridge_controller_1.formatChainIdToHex)(trade.chainId);
|
|
480
479
|
const networkClientId = this.messenger.call('NetworkController:findNetworkClientIdByChainId', hexChainId);
|
|
481
480
|
const requestOptions = {
|
|
482
481
|
actionId,
|
|
@@ -567,34 +566,32 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
567
566
|
* @param accountAddress - The address of the account to submit the transaction for
|
|
568
567
|
* @param quoteResponse - The quote response
|
|
569
568
|
* @param isStxEnabledOnClient - Whether smart transactions are enabled on the client, for example the getSmartTransactionsEnabled selector value from the extension
|
|
570
|
-
* @param
|
|
571
|
-
* @param warnings - The warnings to publish with the QuotesReceived event
|
|
569
|
+
* @param quotesReceivedContext - The context for the QuotesReceived event
|
|
572
570
|
* @returns The transaction meta
|
|
573
571
|
*/
|
|
574
|
-
this.submitTx = async (accountAddress, quoteResponse, isStxEnabledOnClient,
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
this.messenger.call('BridgeController:stopPollingForQuotes');
|
|
572
|
+
this.submitTx = async (accountAddress, quoteResponse, isStxEnabledOnClient, quotesReceivedContext) => {
|
|
573
|
+
this.messenger.call('BridgeController:stopPollingForQuotes', bridge_controller_1.AbortReason.TransactionSubmitted,
|
|
574
|
+
// If trade is submitted before all quotes are loaded, the QuotesReceived event is published
|
|
575
|
+
// 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
|
|
576
|
+
quoteResponse.featureId ? undefined : quotesReceivedContext);
|
|
580
577
|
const selectedAccount = __classPrivateFieldGet(this, _BridgeStatusController_instances, "m", _BridgeStatusController_getMultichainSelectedAccount).call(this, accountAddress);
|
|
581
578
|
if (!selectedAccount) {
|
|
582
579
|
throw new Error('Failed to submit cross-chain swap transaction: undefined multichain account');
|
|
583
580
|
}
|
|
584
|
-
const isHardwareAccount = (0,
|
|
581
|
+
const isHardwareAccount = (0, bridge_controller_1.isHardwareWallet)(selectedAccount);
|
|
585
582
|
const preConfirmationProperties = (0, metrics_1.getPreConfirmationPropertiesFromQuote)(quoteResponse, isStxEnabledOnClient, isHardwareAccount);
|
|
586
583
|
// Emit Submitted event after submit button is clicked
|
|
587
584
|
!quoteResponse.featureId &&
|
|
588
|
-
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this,
|
|
585
|
+
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Submitted, undefined, preConfirmationProperties);
|
|
589
586
|
let txMeta;
|
|
590
587
|
let approvalTxId;
|
|
591
588
|
const startTime = Date.now();
|
|
592
|
-
const isBridgeTx = (0,
|
|
589
|
+
const isBridgeTx = (0, bridge_controller_1.isCrossChain)(quoteResponse.quote.srcChainId, quoteResponse.quote.destChainId);
|
|
593
590
|
// Submit non-EVM tx (Solana, BTC, Tron)
|
|
594
|
-
const isNonEvmTrade = (0,
|
|
591
|
+
const isNonEvmTrade = (0, bridge_controller_1.isNonEvmChainId)(quoteResponse.quote.srcChainId) &&
|
|
595
592
|
(typeof quoteResponse.trade === 'string' ||
|
|
596
|
-
(0,
|
|
597
|
-
(0,
|
|
593
|
+
(0, bridge_controller_1.isBitcoinTrade)(quoteResponse.trade) ||
|
|
594
|
+
(0, bridge_controller_1.isTronTrade)(quoteResponse.trade));
|
|
598
595
|
if (isNonEvmTrade) {
|
|
599
596
|
// Handle non-EVM approval if present (e.g., Tron token approvals)
|
|
600
597
|
if (quoteResponse.approval) {
|
|
@@ -603,7 +600,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
603
600
|
? constants_1.TraceName.BridgeTransactionApprovalCompleted
|
|
604
601
|
: constants_1.TraceName.SwapTransactionApprovalCompleted,
|
|
605
602
|
data: {
|
|
606
|
-
srcChainId: (0,
|
|
603
|
+
srcChainId: (0, bridge_controller_1.formatChainIdToCaip)(quoteResponse.quote.srcChainId),
|
|
607
604
|
stxEnabled: false,
|
|
608
605
|
},
|
|
609
606
|
}, async () => {
|
|
@@ -612,7 +609,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
612
609
|
}
|
|
613
610
|
catch (error) {
|
|
614
611
|
!quoteResponse.featureId &&
|
|
615
|
-
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this,
|
|
612
|
+
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Failed, undefined, {
|
|
616
613
|
error_message: error?.message,
|
|
617
614
|
...preConfirmationProperties,
|
|
618
615
|
});
|
|
@@ -628,7 +625,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
628
625
|
? constants_1.TraceName.BridgeTransactionCompleted
|
|
629
626
|
: constants_1.TraceName.SwapTransactionCompleted,
|
|
630
627
|
data: {
|
|
631
|
-
srcChainId: (0,
|
|
628
|
+
srcChainId: (0, bridge_controller_1.formatChainIdToCaip)(quoteResponse.quote.srcChainId),
|
|
632
629
|
stxEnabled: false,
|
|
633
630
|
},
|
|
634
631
|
}, async () => {
|
|
@@ -637,7 +634,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
637
634
|
}
|
|
638
635
|
catch (error) {
|
|
639
636
|
!quoteResponse.featureId &&
|
|
640
|
-
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this,
|
|
637
|
+
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Failed, txMeta?.id, {
|
|
641
638
|
error_message: error?.message,
|
|
642
639
|
...preConfirmationProperties,
|
|
643
640
|
});
|
|
@@ -656,7 +653,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
656
653
|
? constants_1.TraceName.BridgeTransactionCompleted
|
|
657
654
|
: constants_1.TraceName.SwapTransactionCompleted,
|
|
658
655
|
data: {
|
|
659
|
-
srcChainId: (0,
|
|
656
|
+
srcChainId: (0, bridge_controller_1.formatChainIdToCaip)(quoteResponse.quote.srcChainId),
|
|
660
657
|
stxEnabled: isStxEnabledOnClient,
|
|
661
658
|
},
|
|
662
659
|
}, async () => {
|
|
@@ -700,12 +697,12 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
700
697
|
startTime,
|
|
701
698
|
approvalTxId,
|
|
702
699
|
});
|
|
703
|
-
if ((0,
|
|
700
|
+
if ((0, bridge_controller_1.isNonEvmChainId)(quoteResponse.quote.srcChainId)) {
|
|
704
701
|
// Start polling for bridge tx status
|
|
705
702
|
__classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this, txMeta.id);
|
|
706
703
|
// Track non-EVM Swap completed event
|
|
707
704
|
if (!isBridgeTx) {
|
|
708
|
-
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this,
|
|
705
|
+
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Completed, txMeta.id);
|
|
709
706
|
}
|
|
710
707
|
}
|
|
711
708
|
}
|
|
@@ -723,7 +720,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
723
720
|
*/
|
|
724
721
|
_BridgeStatusController_trackUnifiedSwapBridgeEvent.set(this, (eventName, txMetaId, eventProperties) => {
|
|
725
722
|
const baseProperties = {
|
|
726
|
-
action_type:
|
|
723
|
+
action_type: bridge_controller_1.MetricsActionType.SWAPBRIDGE_V1,
|
|
727
724
|
...(eventProperties ?? {}),
|
|
728
725
|
};
|
|
729
726
|
// This will publish events for PERPS dropped tx failures as well
|
|
@@ -738,7 +735,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
738
735
|
}
|
|
739
736
|
const requestParamProperties = (0, metrics_1.getRequestParamFromHistory)(historyItem);
|
|
740
737
|
// Always publish StatusValidationFailed event, regardless of featureId
|
|
741
|
-
if (eventName ===
|
|
738
|
+
if (eventName === bridge_controller_1.UnifiedSwapBridgeEventName.StatusValidationFailed) {
|
|
742
739
|
const { chain_id_source, chain_id_destination, token_address_source, token_address_destination, } = requestParamProperties;
|
|
743
740
|
this.messenger.call('BridgeController:trackUnifiedSwapBridgeEvent', eventName, {
|
|
744
741
|
...baseProperties,
|
|
@@ -806,16 +803,16 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
806
803
|
__classPrivateFieldGet(this, _BridgeStatusController_markTxAsFailed, "f").call(this, transactionMeta);
|
|
807
804
|
// Track failed event
|
|
808
805
|
if (status !== transaction_controller_1.TransactionStatus.rejected) {
|
|
809
|
-
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this,
|
|
806
|
+
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Failed, id, (0, metrics_1.getEVMTxPropertiesFromTransactionMeta)(transactionMeta));
|
|
810
807
|
}
|
|
811
808
|
}
|
|
812
809
|
});
|
|
813
810
|
this.messenger.subscribe('TransactionController:transactionConfirmed', (transactionMeta) => {
|
|
814
811
|
const { type, id, chainId } = transactionMeta;
|
|
815
812
|
if (type === transaction_controller_1.TransactionType.swap) {
|
|
816
|
-
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this,
|
|
813
|
+
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Completed, id);
|
|
817
814
|
}
|
|
818
|
-
if (type === transaction_controller_1.TransactionType.bridge && !(0,
|
|
815
|
+
if (type === transaction_controller_1.TransactionType.bridge && !(0, bridge_controller_1.isNonEvmChainId)(chainId)) {
|
|
819
816
|
__classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this, id);
|
|
820
817
|
}
|
|
821
818
|
});
|