@metamask/bridge-status-controller 64.4.4 → 64.4.5
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 +12 -1
- package/dist/bridge-status-controller.cjs +125 -40
- package/dist/bridge-status-controller.cjs.map +1 -1
- package/dist/bridge-status-controller.d.cts.map +1 -1
- package/dist/bridge-status-controller.d.mts.map +1 -1
- package/dist/bridge-status-controller.mjs +126 -41
- package/dist/bridge-status-controller.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +3 -2
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +3 -2
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/transaction.cjs +33 -1
- package/dist/utils/transaction.cjs.map +1 -1
- package/dist/utils/transaction.d.cts +23 -1
- package/dist/utils/transaction.d.cts.map +1 -1
- package/dist/utils/transaction.d.mts +23 -1
- package/dist/utils/transaction.d.mts.map +1 -1
- package/dist/utils/transaction.mjs +30 -0
- package/dist/utils/transaction.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [64.4.5]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Bump `@metamask/bridge-controller` from `^64.8.1` to `^64.8.2` ([#7722](https://github.com/MetaMask/core/pull/7722))
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Fix transaction failure tracking for pre-submission failures by using `actionId` as a temporary history key ([#7696](https://github.com/MetaMask/core/pull/7696))
|
|
19
|
+
|
|
10
20
|
## [64.4.4]
|
|
11
21
|
|
|
12
22
|
### Changed
|
|
@@ -887,7 +897,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
887
897
|
|
|
888
898
|
- Initial release ([#5317](https://github.com/MetaMask/core/pull/5317))
|
|
889
899
|
|
|
890
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@64.4.
|
|
900
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@64.4.5...HEAD
|
|
901
|
+
[64.4.5]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@64.4.4...@metamask/bridge-status-controller@64.4.5
|
|
891
902
|
[64.4.4]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@64.4.3...@metamask/bridge-status-controller@64.4.4
|
|
892
903
|
[64.4.3]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@64.4.2...@metamask/bridge-status-controller@64.4.3
|
|
893
904
|
[64.4.2]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@64.4.1...@metamask/bridge-status-controller@64.4.2
|
|
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
11
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
12
|
};
|
|
13
|
-
var _BridgeStatusController_instances, _BridgeStatusController_pollingTokensByTxMetaId, _BridgeStatusController_clientId, _BridgeStatusController_fetchFn, _BridgeStatusController_config, _BridgeStatusController_addTransactionFn, _BridgeStatusController_addTransactionBatchFn, _BridgeStatusController_updateTransactionFn, _BridgeStatusController_estimateGasFeeFn, _BridgeStatusController_trace, _BridgeStatusController_markTxAsFailed, _BridgeStatusController_restartPollingForIncompleteHistoryItems, _BridgeStatusController_addTxToHistory, _BridgeStatusController_startPollingForTxId, _BridgeStatusController_getMultichainSelectedAccount, _BridgeStatusController_handleFetchFailure, _BridgeStatusController_fetchBridgeTxStatus, _BridgeStatusController_fetchIntentOrderStatus, _BridgeStatusController_updateBridgeHistoryFromIntentOrder, _BridgeStatusController_getSrcTxHash, _BridgeStatusController_updateSrcTxHash, _BridgeStatusController_wipeBridgeStatusByChainId, _BridgeStatusController_handleNonEvmTx, _BridgeStatusController_waitForHashAndReturnFinalTxMeta, _BridgeStatusController_waitForTxConfirmation, _BridgeStatusController_handleApprovalTx, _BridgeStatusController_handleEvmTransaction, _BridgeStatusController_handleUSDTAllowanceReset, _BridgeStatusController_calculateGasFees, _BridgeStatusController_handleEvmTransactionBatch, _BridgeStatusController_trackUnifiedSwapBridgeEvent;
|
|
13
|
+
var _BridgeStatusController_instances, _BridgeStatusController_pollingTokensByTxMetaId, _BridgeStatusController_clientId, _BridgeStatusController_fetchFn, _BridgeStatusController_config, _BridgeStatusController_addTransactionFn, _BridgeStatusController_addTransactionBatchFn, _BridgeStatusController_updateTransactionFn, _BridgeStatusController_estimateGasFeeFn, _BridgeStatusController_trace, _BridgeStatusController_markTxAsFailed, _BridgeStatusController_restartPollingForIncompleteHistoryItems, _BridgeStatusController_addTxToHistory, _BridgeStatusController_rekeyHistoryItem, _BridgeStatusController_startPollingForTxId, _BridgeStatusController_getMultichainSelectedAccount, _BridgeStatusController_handleFetchFailure, _BridgeStatusController_fetchBridgeTxStatus, _BridgeStatusController_fetchIntentOrderStatus, _BridgeStatusController_updateBridgeHistoryFromIntentOrder, _BridgeStatusController_getSrcTxHash, _BridgeStatusController_updateSrcTxHash, _BridgeStatusController_wipeBridgeStatusByChainId, _BridgeStatusController_handleNonEvmTx, _BridgeStatusController_waitForHashAndReturnFinalTxMeta, _BridgeStatusController_waitForTxConfirmation, _BridgeStatusController_handleApprovalTx, _BridgeStatusController_handleEvmTransaction, _BridgeStatusController_handleUSDTAllowanceReset, _BridgeStatusController_calculateGasFees, _BridgeStatusController_handleEvmTransactionBatch, _BridgeStatusController_trackUnifiedSwapBridgeEvent;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.BridgeStatusController = void 0;
|
|
16
16
|
const bridge_controller_1 = require("@metamask/bridge-controller");
|
|
@@ -59,15 +59,23 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
59
59
|
_BridgeStatusController_estimateGasFeeFn.set(this, void 0);
|
|
60
60
|
_BridgeStatusController_trace.set(this, void 0);
|
|
61
61
|
// Mark tx as failed in txHistory if either the approval or trade fails
|
|
62
|
-
_BridgeStatusController_markTxAsFailed.set(this, ({ id }) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
_BridgeStatusController_markTxAsFailed.set(this, ({ id: txMetaId, actionId, }) => {
|
|
63
|
+
// Look up by txMetaId first
|
|
64
|
+
let txHistoryKey = this.state.txHistory[txMetaId]
|
|
65
|
+
? txMetaId
|
|
66
|
+
: undefined;
|
|
67
|
+
// If not found by txMetaId, try looking up by actionId (for pre-submission failures)
|
|
68
|
+
if (!txHistoryKey && actionId && this.state.txHistory[actionId]) {
|
|
69
|
+
txHistoryKey = actionId;
|
|
70
|
+
}
|
|
71
|
+
// If still not found, try looking up by approvalTxId
|
|
72
|
+
txHistoryKey ?? (txHistoryKey = Object.keys(this.state.txHistory).find((key) => this.state.txHistory[key].approvalTxId === txMetaId));
|
|
66
73
|
if (!txHistoryKey) {
|
|
67
74
|
return;
|
|
68
75
|
}
|
|
76
|
+
const key = txHistoryKey;
|
|
69
77
|
this.update((statusState) => {
|
|
70
|
-
statusState.txHistory[
|
|
78
|
+
statusState.txHistory[key].status.status = bridge_controller_1.StatusTypes.FAILED;
|
|
71
79
|
});
|
|
72
80
|
});
|
|
73
81
|
this.resetState = () => {
|
|
@@ -155,6 +163,8 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
155
163
|
const incompleteHistoryItems = historyItems
|
|
156
164
|
.filter((historyItem) => historyItem.status.status === bridge_controller_1.StatusTypes.PENDING ||
|
|
157
165
|
historyItem.status.status === bridge_controller_1.StatusTypes.UNKNOWN)
|
|
166
|
+
// Only poll items with txMetaId (post-submission items)
|
|
167
|
+
.filter((historyItem) => Boolean(historyItem.txMetaId))
|
|
158
168
|
.filter((historyItem) => {
|
|
159
169
|
// Check if we are already polling this tx, if so, skip restarting polling for that
|
|
160
170
|
const pollingToken = __classPrivateFieldGet(this, _BridgeStatusController_pollingTokensByTxMetaId, "f")[historyItem.txMetaId];
|
|
@@ -176,15 +186,20 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
176
186
|
__classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this, bridgeTxMetaId);
|
|
177
187
|
});
|
|
178
188
|
});
|
|
179
|
-
_BridgeStatusController_addTxToHistory.set(this, (startPollingForBridgeTxStatusArgs) => {
|
|
189
|
+
_BridgeStatusController_addTxToHistory.set(this, (startPollingForBridgeTxStatusArgs, actionId) => {
|
|
180
190
|
const { bridgeTxMeta, statusRequest, quoteResponse, startTime, slippagePercentage, initialDestAssetBalance, targetContractAddress, approvalTxId, isStxEnabled, accountAddress: selectedAddress, } = startPollingForBridgeTxStatusArgs;
|
|
191
|
+
// Determine the key for this history item:
|
|
192
|
+
// - For pre-submission (non-batch EVM): use actionId
|
|
193
|
+
// - For post-submission or other cases: use bridgeTxMeta.id
|
|
194
|
+
const historyKey = (0, transaction_1.getHistoryKey)(actionId, bridgeTxMeta?.id);
|
|
181
195
|
// Write all non-status fields to state so we can reference the quote in Activity list without the Bridge API
|
|
182
196
|
// We know it's in progress but not the exact status yet
|
|
183
197
|
const txHistoryItem = {
|
|
184
|
-
txMetaId: bridgeTxMeta
|
|
198
|
+
txMetaId: bridgeTxMeta?.id,
|
|
199
|
+
actionId,
|
|
185
200
|
originalTransactionId: bridgeTxMeta
|
|
186
|
-
|
|
187
|
-
batchId: bridgeTxMeta
|
|
201
|
+
?.originalTransactionId || bridgeTxMeta?.id, // Keep original for intent transactions
|
|
202
|
+
batchId: bridgeTxMeta?.batchId,
|
|
188
203
|
quote: quoteResponse.quote,
|
|
189
204
|
startTime,
|
|
190
205
|
estimatedProcessingTimeInSeconds: quoteResponse.estimatedProcessingTimeInSeconds,
|
|
@@ -214,8 +229,42 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
214
229
|
featureId: quoteResponse.featureId,
|
|
215
230
|
};
|
|
216
231
|
this.update((state) => {
|
|
217
|
-
// Use
|
|
218
|
-
state.txHistory[
|
|
232
|
+
// Use actionId as key for pre-submission, or txMeta.id for post-submission
|
|
233
|
+
state.txHistory[historyKey] = txHistoryItem;
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
/**
|
|
237
|
+
* Rekeys a history item from actionId to txMeta.id after successful submission.
|
|
238
|
+
* Also updates txMetaId and srcTxHash which weren't available pre-submission.
|
|
239
|
+
*
|
|
240
|
+
* @param actionId - The actionId used as the temporary key for the history item
|
|
241
|
+
* @param txMeta - The transaction meta from the successful submission
|
|
242
|
+
* @param txMeta.id - The transaction meta id to use as the new key
|
|
243
|
+
* @param txMeta.hash - The transaction hash to set on the history item
|
|
244
|
+
*/
|
|
245
|
+
_BridgeStatusController_rekeyHistoryItem.set(this, (actionId, txMeta) => {
|
|
246
|
+
const historyItem = this.state.txHistory[actionId];
|
|
247
|
+
if (!historyItem) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
this.update((state) => {
|
|
251
|
+
// Update fields that weren't available pre-submission
|
|
252
|
+
const updatedItem = {
|
|
253
|
+
...historyItem,
|
|
254
|
+
txMetaId: txMeta.id,
|
|
255
|
+
originalTransactionId: historyItem.originalTransactionId ?? txMeta.id,
|
|
256
|
+
status: {
|
|
257
|
+
...historyItem.status,
|
|
258
|
+
srcChain: {
|
|
259
|
+
...historyItem.status.srcChain,
|
|
260
|
+
txHash: txMeta.hash ?? historyItem.status.srcChain?.txHash,
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
// Add under new key (txMeta.id)
|
|
265
|
+
state.txHistory[txMeta.id] = updatedItem;
|
|
266
|
+
// Remove old key (actionId)
|
|
267
|
+
delete state.txHistory[actionId];
|
|
219
268
|
});
|
|
220
269
|
});
|
|
221
270
|
_BridgeStatusController_startPollingForTxId.set(this, (txId) => {
|
|
@@ -249,6 +298,9 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
249
298
|
*/
|
|
250
299
|
this.startPollingForBridgeTxStatus = (txHistoryMeta) => {
|
|
251
300
|
const { bridgeTxMeta } = txHistoryMeta;
|
|
301
|
+
if (!bridgeTxMeta?.id) {
|
|
302
|
+
throw new Error('Cannot start polling: bridgeTxMeta.id is required for polling');
|
|
303
|
+
}
|
|
252
304
|
__classPrivateFieldGet(this, _BridgeStatusController_addTxToHistory, "f").call(this, txHistoryMeta);
|
|
253
305
|
__classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this, bridgeTxMeta.id);
|
|
254
306
|
};
|
|
@@ -535,10 +587,12 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
535
587
|
* @param params.txFee - Optional gas fee parameters from the quote (used when gasIncluded is true)
|
|
536
588
|
* @param params.txFee.maxFeePerGas - The maximum fee per gas from the quote
|
|
537
589
|
* @param params.txFee.maxPriorityFeePerGas - The maximum priority fee per gas from the quote
|
|
590
|
+
* @param params.actionId - Optional actionId for pre-submission history (if not provided, one is generated)
|
|
538
591
|
* @returns The transaction meta
|
|
539
592
|
*/
|
|
540
|
-
_BridgeStatusController_handleEvmTransaction.set(this, async ({ transactionType, trade, requireApproval = false, txFee, }) => {
|
|
541
|
-
|
|
593
|
+
_BridgeStatusController_handleEvmTransaction.set(this, async ({ transactionType, trade, requireApproval = false, txFee, actionId: providedActionId, }) => {
|
|
594
|
+
// Use provided actionId (for pre-submission history) or generate one
|
|
595
|
+
const actionId = providedActionId ?? (0, transaction_1.generateActionId)().toString();
|
|
542
596
|
const selectedAccount = this.messenger.call('AccountsController:getAccountByAddress', trade.from);
|
|
543
597
|
if (!selectedAccount) {
|
|
544
598
|
throw new Error('Failed to submit cross-chain swap transaction: unknown account in trade data');
|
|
@@ -766,9 +820,25 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
766
820
|
: undefined, quoteResponse.resetApproval, requireApproval);
|
|
767
821
|
approvalTxId = approvalTxMeta?.id;
|
|
768
822
|
await (0, transaction_1.handleMobileHardwareWalletDelay)(requireApproval);
|
|
823
|
+
// Generate actionId for pre-submission history (non-batch EVM only)
|
|
824
|
+
const actionId = (0, transaction_1.generateActionId)().toString();
|
|
825
|
+
// Add pre-submission history keyed by actionId
|
|
826
|
+
// This ensures we have quote data available if transaction fails during submission
|
|
827
|
+
__classPrivateFieldGet(this, _BridgeStatusController_addTxToHistory, "f").call(this, {
|
|
828
|
+
accountAddress: selectedAccount.address,
|
|
829
|
+
statusRequest: {
|
|
830
|
+
...(0, transaction_1.getStatusRequestParams)(quoteResponse),
|
|
831
|
+
srcTxHash: '', // Not available yet
|
|
832
|
+
},
|
|
833
|
+
quoteResponse,
|
|
834
|
+
slippagePercentage: 0,
|
|
835
|
+
isStxEnabled: isStxEnabledOnClient,
|
|
836
|
+
startTime,
|
|
837
|
+
approvalTxId,
|
|
838
|
+
}, actionId);
|
|
769
839
|
// Pass txFee when gasIncluded is true to use the quote's gas fees
|
|
770
840
|
// instead of re-estimating (which would fail for max native token swaps)
|
|
771
|
-
|
|
841
|
+
const tradeTxMeta = await __classPrivateFieldGet(this, _BridgeStatusController_handleEvmTransaction, "f").call(this, {
|
|
772
842
|
transactionType: isBridgeTx
|
|
773
843
|
? transaction_controller_1.TransactionType.bridge
|
|
774
844
|
: transaction_controller_1.TransactionType.swap,
|
|
@@ -777,24 +847,35 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
777
847
|
txFee: quoteResponse.quote.gasIncluded
|
|
778
848
|
? quoteResponse.quote.feeData.txFee
|
|
779
849
|
: undefined,
|
|
850
|
+
actionId,
|
|
780
851
|
});
|
|
852
|
+
// On success, rekey from actionId to txMeta.id and update srcTxHash
|
|
853
|
+
__classPrivateFieldGet(this, _BridgeStatusController_rekeyHistoryItem, "f").call(this, actionId, tradeTxMeta);
|
|
854
|
+
return tradeTxMeta;
|
|
781
855
|
});
|
|
782
856
|
}
|
|
783
857
|
try {
|
|
784
|
-
//
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
858
|
+
// For non-batch EVM transactions, history was already added/rekeyed above
|
|
859
|
+
// Only add history here for non-EVM and batch EVM transactions
|
|
860
|
+
const isNonBatchEvm = !(0, bridge_controller_1.isNonEvmChainId)(quoteResponse.quote.srcChainId) &&
|
|
861
|
+
!isStxEnabledOnClient &&
|
|
862
|
+
!quoteResponse.quote.gasIncluded7702;
|
|
863
|
+
if (!isNonBatchEvm) {
|
|
864
|
+
// Add swap or bridge tx to history
|
|
865
|
+
__classPrivateFieldGet(this, _BridgeStatusController_addTxToHistory, "f").call(this, {
|
|
866
|
+
accountAddress: selectedAccount.address,
|
|
867
|
+
bridgeTxMeta: txMeta, // Only the id field is used by the BridgeStatusController
|
|
868
|
+
statusRequest: {
|
|
869
|
+
...(0, transaction_1.getStatusRequestParams)(quoteResponse),
|
|
870
|
+
srcTxHash: txMeta.hash,
|
|
871
|
+
},
|
|
872
|
+
quoteResponse,
|
|
873
|
+
slippagePercentage: 0, // TODO include slippage provided by quote if using dynamic slippage, or slippage from quote request
|
|
874
|
+
isStxEnabled: isStxEnabledOnClient,
|
|
875
|
+
startTime,
|
|
876
|
+
approvalTxId,
|
|
877
|
+
});
|
|
878
|
+
}
|
|
798
879
|
if ((0, bridge_controller_1.isNonEvmChainId)(quoteResponse.quote.srcChainId)) {
|
|
799
880
|
// Start polling for bridge tx status
|
|
800
881
|
__classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this, txMeta.id);
|
|
@@ -827,11 +908,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
827
908
|
const isHardwareAccount = Boolean(account) && (0, bridge_controller_1.isHardwareWallet)(account);
|
|
828
909
|
const preConfirmationProperties = (0, metrics_1.getPreConfirmationPropertiesFromQuote)(quoteResponse, false, isHardwareAccount);
|
|
829
910
|
try {
|
|
830
|
-
const
|
|
831
|
-
.quote;
|
|
832
|
-
if (!intent) {
|
|
833
|
-
throw new Error('submitIntent: missing intent data');
|
|
834
|
-
}
|
|
911
|
+
const intent = (0, transaction_1.getIntentFromQuote)(quoteResponse);
|
|
835
912
|
// If backend provided an approval tx for this intent quote, submit it first (on-chain),
|
|
836
913
|
// then proceed with off-chain intent submission.
|
|
837
914
|
let approvalTxId;
|
|
@@ -1017,7 +1094,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
1017
1094
|
// Set interval
|
|
1018
1095
|
this.setIntervalLength(constants_1.REFRESH_INTERVAL_MS);
|
|
1019
1096
|
this.messenger.subscribe('TransactionController:transactionFailed', ({ transactionMeta }) => {
|
|
1020
|
-
const { type, status, id } = transactionMeta;
|
|
1097
|
+
const { type, status, id: txMetaId, actionId } = transactionMeta;
|
|
1021
1098
|
if (type &&
|
|
1022
1099
|
[
|
|
1023
1100
|
transaction_controller_1.TransactionType.bridge,
|
|
@@ -1034,17 +1111,25 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
1034
1111
|
__classPrivateFieldGet(this, _BridgeStatusController_markTxAsFailed, "f").call(this, transactionMeta);
|
|
1035
1112
|
// Track failed event
|
|
1036
1113
|
if (status !== transaction_controller_1.TransactionStatus.rejected) {
|
|
1037
|
-
|
|
1114
|
+
// Look up history by txMetaId first, then by actionId (for pre-submission failures)
|
|
1115
|
+
let historyKey;
|
|
1116
|
+
if (this.state.txHistory[txMetaId]) {
|
|
1117
|
+
historyKey = txMetaId;
|
|
1118
|
+
}
|
|
1119
|
+
else if (actionId && this.state.txHistory[actionId]) {
|
|
1120
|
+
historyKey = actionId;
|
|
1121
|
+
}
|
|
1122
|
+
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Failed, historyKey ?? txMetaId, (0, metrics_1.getEVMTxPropertiesFromTransactionMeta)(transactionMeta));
|
|
1038
1123
|
}
|
|
1039
1124
|
}
|
|
1040
1125
|
});
|
|
1041
1126
|
this.messenger.subscribe('TransactionController:transactionConfirmed', (transactionMeta) => {
|
|
1042
|
-
const { type, id, chainId } = transactionMeta;
|
|
1127
|
+
const { type, id: txMetaId, chainId } = transactionMeta;
|
|
1043
1128
|
if (type === transaction_controller_1.TransactionType.swap) {
|
|
1044
|
-
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Completed,
|
|
1129
|
+
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Completed, txMetaId);
|
|
1045
1130
|
}
|
|
1046
1131
|
if (type === transaction_controller_1.TransactionType.bridge && !(0, bridge_controller_1.isNonEvmChainId)(chainId)) {
|
|
1047
|
-
__classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this,
|
|
1132
|
+
__classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this, txMetaId);
|
|
1048
1133
|
}
|
|
1049
1134
|
});
|
|
1050
1135
|
// If you close the extension, but keep the browser open, the polling continues
|
|
@@ -1054,7 +1139,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
1054
1139
|
}
|
|
1055
1140
|
}
|
|
1056
1141
|
exports.BridgeStatusController = BridgeStatusController;
|
|
1057
|
-
_BridgeStatusController_pollingTokensByTxMetaId = new WeakMap(), _BridgeStatusController_clientId = new WeakMap(), _BridgeStatusController_fetchFn = new WeakMap(), _BridgeStatusController_config = new WeakMap(), _BridgeStatusController_addTransactionFn = new WeakMap(), _BridgeStatusController_addTransactionBatchFn = new WeakMap(), _BridgeStatusController_updateTransactionFn = new WeakMap(), _BridgeStatusController_estimateGasFeeFn = new WeakMap(), _BridgeStatusController_trace = new WeakMap(), _BridgeStatusController_markTxAsFailed = new WeakMap(), _BridgeStatusController_restartPollingForIncompleteHistoryItems = new WeakMap(), _BridgeStatusController_addTxToHistory = new WeakMap(), _BridgeStatusController_startPollingForTxId = new WeakMap(), _BridgeStatusController_handleFetchFailure = new WeakMap(), _BridgeStatusController_fetchBridgeTxStatus = new WeakMap(), _BridgeStatusController_fetchIntentOrderStatus = new WeakMap(), _BridgeStatusController_getSrcTxHash = new WeakMap(), _BridgeStatusController_updateSrcTxHash = new WeakMap(), _BridgeStatusController_wipeBridgeStatusByChainId = new WeakMap(), _BridgeStatusController_handleNonEvmTx = new WeakMap(), _BridgeStatusController_waitForHashAndReturnFinalTxMeta = new WeakMap(), _BridgeStatusController_waitForTxConfirmation = new WeakMap(), _BridgeStatusController_handleApprovalTx = new WeakMap(), _BridgeStatusController_handleEvmTransaction = new WeakMap(), _BridgeStatusController_handleUSDTAllowanceReset = new WeakMap(), _BridgeStatusController_calculateGasFees = new WeakMap(), _BridgeStatusController_handleEvmTransactionBatch = new WeakMap(), _BridgeStatusController_trackUnifiedSwapBridgeEvent = new WeakMap(), _BridgeStatusController_instances = new WeakSet(), _BridgeStatusController_getMultichainSelectedAccount = function _BridgeStatusController_getMultichainSelectedAccount(accountAddress) {
|
|
1142
|
+
_BridgeStatusController_pollingTokensByTxMetaId = new WeakMap(), _BridgeStatusController_clientId = new WeakMap(), _BridgeStatusController_fetchFn = new WeakMap(), _BridgeStatusController_config = new WeakMap(), _BridgeStatusController_addTransactionFn = new WeakMap(), _BridgeStatusController_addTransactionBatchFn = new WeakMap(), _BridgeStatusController_updateTransactionFn = new WeakMap(), _BridgeStatusController_estimateGasFeeFn = new WeakMap(), _BridgeStatusController_trace = new WeakMap(), _BridgeStatusController_markTxAsFailed = new WeakMap(), _BridgeStatusController_restartPollingForIncompleteHistoryItems = new WeakMap(), _BridgeStatusController_addTxToHistory = new WeakMap(), _BridgeStatusController_rekeyHistoryItem = new WeakMap(), _BridgeStatusController_startPollingForTxId = new WeakMap(), _BridgeStatusController_handleFetchFailure = new WeakMap(), _BridgeStatusController_fetchBridgeTxStatus = new WeakMap(), _BridgeStatusController_fetchIntentOrderStatus = new WeakMap(), _BridgeStatusController_getSrcTxHash = new WeakMap(), _BridgeStatusController_updateSrcTxHash = new WeakMap(), _BridgeStatusController_wipeBridgeStatusByChainId = new WeakMap(), _BridgeStatusController_handleNonEvmTx = new WeakMap(), _BridgeStatusController_waitForHashAndReturnFinalTxMeta = new WeakMap(), _BridgeStatusController_waitForTxConfirmation = new WeakMap(), _BridgeStatusController_handleApprovalTx = new WeakMap(), _BridgeStatusController_handleEvmTransaction = new WeakMap(), _BridgeStatusController_handleUSDTAllowanceReset = new WeakMap(), _BridgeStatusController_calculateGasFees = new WeakMap(), _BridgeStatusController_handleEvmTransactionBatch = new WeakMap(), _BridgeStatusController_trackUnifiedSwapBridgeEvent = new WeakMap(), _BridgeStatusController_instances = new WeakSet(), _BridgeStatusController_getMultichainSelectedAccount = function _BridgeStatusController_getMultichainSelectedAccount(accountAddress) {
|
|
1058
1143
|
return this.messenger.call('AccountsController:getAccountByAddress', accountAddress);
|
|
1059
1144
|
}, _BridgeStatusController_updateBridgeHistoryFromIntentOrder = function _BridgeStatusController_updateBridgeHistoryFromIntentOrder(bridgeTxMetaId, intentOrder, historyItem) {
|
|
1060
1145
|
const { srcChainId } = historyItem.quote;
|