@metamask-previews/bridge-status-controller 70.0.5-preview-1e3393b67 → 70.0.5-preview-8e9c439
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 +14 -0
- package/dist/bridge-status-controller.cjs +202 -132
- 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 +206 -136
- package/dist/bridge-status-controller.mjs.map +1 -1
- package/dist/constants.cjs +2 -1
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +1 -0
- package/dist/constants.d.cts.map +1 -1
- package/dist/constants.d.mts +1 -0
- package/dist/constants.d.mts.map +1 -1
- package/dist/constants.mjs +1 -0
- package/dist/constants.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +4 -3
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +4 -3
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/bridge-status.cjs +39 -1
- package/dist/utils/bridge-status.cjs.map +1 -1
- package/dist/utils/bridge-status.d.cts +2 -1
- package/dist/utils/bridge-status.d.cts.map +1 -1
- package/dist/utils/bridge-status.d.mts +2 -1
- package/dist/utils/bridge-status.d.mts.map +1 -1
- package/dist/utils/bridge-status.mjs +38 -1
- package/dist/utils/bridge-status.mjs.map +1 -1
- package/dist/utils/feature-flags.cjs +12 -0
- package/dist/utils/feature-flags.cjs.map +1 -0
- package/dist/utils/feature-flags.d.cts +3 -0
- package/dist/utils/feature-flags.d.cts.map +1 -0
- package/dist/utils/feature-flags.d.mts +3 -0
- package/dist/utils/feature-flags.d.mts.map +1 -0
- package/dist/utils/feature-flags.mjs +8 -0
- package/dist/utils/feature-flags.mjs.map +1 -0
- package/dist/utils/history.cjs +49 -2
- package/dist/utils/history.cjs.map +1 -1
- package/dist/utils/history.d.cts +12 -1
- package/dist/utils/history.d.cts.map +1 -1
- package/dist/utils/history.d.mts +12 -1
- package/dist/utils/history.d.mts.map +1 -1
- package/dist/utils/history.mjs +46 -2
- package/dist/utils/history.mjs.map +1 -1
- package/dist/utils/metrics.cjs +39 -8
- package/dist/utils/metrics.cjs.map +1 -1
- package/dist/utils/metrics.d.cts +31 -5
- package/dist/utils/metrics.d.cts.map +1 -1
- package/dist/utils/metrics.d.mts +31 -5
- package/dist/utils/metrics.d.mts.map +1 -1
- package/dist/utils/metrics.mjs +38 -8
- package/dist/utils/metrics.mjs.map +1 -1
- package/dist/utils/network.cjs +7 -1
- package/dist/utils/network.cjs.map +1 -1
- package/dist/utils/network.d.cts +4 -2
- package/dist/utils/network.d.cts.map +1 -1
- package/dist/utils/network.d.mts +4 -2
- package/dist/utils/network.d.mts.map +1 -1
- package/dist/utils/network.mjs +5 -0
- package/dist/utils/network.mjs.map +1 -1
- package/dist/utils/transaction.cjs +1 -1
- package/dist/utils/transaction.cjs.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/dist/utils/transaction.mjs +1 -1
- package/dist/utils/transaction.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
11
|
|
|
12
|
+
- Remove stale bridge transactions from `txHistory` to prevent excessive polling. Once a history item exceeds the configured maximum age, polling backs off exponentially and also checks for the src tx hash's receipt. If there is no receipt, the history item's hash is presumed to be invalid and is deleted from state. ([#8479](https://github.com/MetaMask/core/pull/8479))
|
|
12
13
|
- Add missing action types for public `BridgeStatusController` methods ([#8367](https://github.com/MetaMask/core/pull/8367))
|
|
13
14
|
- The following types are now available:
|
|
14
15
|
- `BridgeStatusControllerSubmitTxAction`
|
|
@@ -17,6 +18,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
17
18
|
|
|
18
19
|
### Changed
|
|
19
20
|
|
|
21
|
+
- **BREAKING:** Replace `transactionFailed` and `transactionConfirmed` event subscriptions with `TransactionController:transactionStatusUpdated` ([#8479](https://github.com/MetaMask/core/pull/8479))
|
|
22
|
+
- **BREAKING:** Add `RemoteFeatureFlags:getState` to allowed actions to retrieve max history item age config ([#8479](https://github.com/MetaMask/core/pull/8479))
|
|
23
|
+
- Add `account_hardware_type` field to all cross-chain swap analytics events ([#8503](https://github.com/MetaMask/core/pull/8503))
|
|
24
|
+
- `account_hardware_type` carries the specific hardware wallet brand (e.g. `'Ledger'`, `'QR Hardware'`) or `null` for software wallets
|
|
25
|
+
- `is_hardware_wallet` is now derived from `account_hardware_type !== null`, keeping both fields in sync
|
|
26
|
+
- `getEVMTxPropertiesFromTransactionMeta` now accepts an optional `account` parameter to populate `account_hardware_type` for `TransactionController:transactionFailed` events ([#8503](https://github.com/MetaMask/core/pull/8503))
|
|
20
27
|
- Bump `@metamask/accounts-controller` from `^37.1.1` to `^37.2.0` ([#8363](https://github.com/MetaMask/core/pull/8363))
|
|
21
28
|
- Bump `@metamask/keyring-controller` from `^25.1.1` to `^25.2.0` ([#8363](https://github.com/MetaMask/core/pull/8363))
|
|
22
29
|
- Bump `@metamask/messenger` from `^1.0.0` to `^1.1.1` ([#8364](https://github.com/MetaMask/core/pull/8364), [#8373](https://github.com/MetaMask/core/pull/8373))
|
|
@@ -24,6 +31,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
24
31
|
- Bump `@metamask/base-controller` from `^9.0.1` to `^9.1.0` ([#8457](https://github.com/MetaMask/core/pull/8457))
|
|
25
32
|
- Bump `@metamask/bridge-controller` from `^70.0.1` to `^70.1.1` ([#8466](https://github.com/MetaMask/core/pull/8466), [#8474](https://github.com/MetaMask/core/pull/8474))
|
|
26
33
|
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- Prevent invalid src hashes from being persisted in `txHistory` ([#8479](https://github.com/MetaMask/core/pull/8479))
|
|
37
|
+
- Make transaction status subscribers generic so that `txHistory` items get updated if there are any transaction updates matching by actionId, txMetaId, hash or type
|
|
38
|
+
- Skip saving smart transaction hashes on transaction submission. This used to make it possible for invalid src hashes to be stored in state and polled indefinitely. Instead, the txHistory item will now be updated with the confirmed tx hash when the `transactionStatusUpdated` event is published
|
|
39
|
+
- If there is no srcTxHash in state, attempt to set it based on the local TransactionController state
|
|
40
|
+
|
|
27
41
|
## [70.0.5]
|
|
28
42
|
|
|
29
43
|
### Changed
|
|
@@ -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_pollingTokensByTxMetaId, _BridgeStatusController_intentManager, _BridgeStatusController_clientId, _BridgeStatusController_fetchFn, _BridgeStatusController_config, _BridgeStatusController_addTransactionBatchFn, _BridgeStatusController_trace,
|
|
13
|
+
var _BridgeStatusController_pollingTokensByTxMetaId, _BridgeStatusController_intentManager, _BridgeStatusController_clientId, _BridgeStatusController_fetchFn, _BridgeStatusController_config, _BridgeStatusController_addTransactionBatchFn, _BridgeStatusController_trace, _BridgeStatusController_onTransactionFailed, _BridgeStatusController_onTransactionConfirmed, _BridgeStatusController_restartPollingForIncompleteHistoryItems, _BridgeStatusController_addTxToHistory, _BridgeStatusController_rekeyHistoryItem, _BridgeStatusController_startPollingForTxId, _BridgeStatusController_handleFetchFailure, _BridgeStatusController_fetchBridgeTxStatus, _BridgeStatusController_setAndGetSrcTxHash, _BridgeStatusController_updateHistoryItem, _BridgeStatusController_deleteHistoryItem, _BridgeStatusController_wipeBridgeStatusByChainId, _BridgeStatusController_handleApprovalTx, _BridgeStatusController_handleEvmTransactionBatch, _BridgeStatusController_trackPollingStatusUpdatedEvent, _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");
|
|
@@ -70,25 +70,45 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
70
70
|
_BridgeStatusController_config.set(this, void 0);
|
|
71
71
|
_BridgeStatusController_addTransactionBatchFn.set(this, void 0);
|
|
72
72
|
_BridgeStatusController_trace.set(this, void 0);
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
_BridgeStatusController_onTransactionFailed.set(this, ({ txMeta, historyKey, }) => {
|
|
74
|
+
__classPrivateFieldGet(this, _BridgeStatusController_updateHistoryItem, "f").call(this, {
|
|
75
|
+
historyKey,
|
|
76
|
+
status: bridge_controller_1.StatusTypes.FAILED,
|
|
77
|
+
txHash: txMeta.type &&
|
|
78
|
+
[transaction_controller_1.TransactionType.bridge, transaction_controller_1.TransactionType.swap].includes(txMeta.type)
|
|
79
|
+
? txMeta.hash
|
|
80
|
+
: undefined,
|
|
81
|
+
});
|
|
82
|
+
if (txMeta.status === transaction_controller_1.TransactionStatus.rejected) {
|
|
83
|
+
return;
|
|
82
84
|
}
|
|
83
|
-
//
|
|
84
|
-
|
|
85
|
-
if (!txHistoryKey) {
|
|
85
|
+
// Skip account lookup and tracking when featureId is set (e.g. PERPS)
|
|
86
|
+
if (historyKey && this.state.txHistory[historyKey]?.featureId) {
|
|
86
87
|
return;
|
|
87
88
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Failed, historyKey, (0, metrics_1.getEVMTxPropertiesFromTransactionMeta)(txMeta));
|
|
90
|
+
});
|
|
91
|
+
// Only EVM txs
|
|
92
|
+
_BridgeStatusController_onTransactionConfirmed.set(this, ({ txMeta, historyKey, }) => {
|
|
93
|
+
__classPrivateFieldGet(this, _BridgeStatusController_updateHistoryItem, "f").call(this, {
|
|
94
|
+
historyKey,
|
|
95
|
+
txHash: txMeta.hash,
|
|
91
96
|
});
|
|
97
|
+
console.log('======TransactionController:transactionConfirmed', txMeta);
|
|
98
|
+
switch (txMeta.type) {
|
|
99
|
+
case transaction_controller_1.TransactionType.swap:
|
|
100
|
+
__classPrivateFieldGet(this, _BridgeStatusController_updateHistoryItem, "f").call(this, {
|
|
101
|
+
historyKey,
|
|
102
|
+
status: bridge_controller_1.StatusTypes.COMPLETE,
|
|
103
|
+
});
|
|
104
|
+
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Completed, historyKey);
|
|
105
|
+
break;
|
|
106
|
+
default:
|
|
107
|
+
if (historyKey) {
|
|
108
|
+
__classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this, historyKey);
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
92
112
|
});
|
|
93
113
|
this.resetState = () => {
|
|
94
114
|
this.update((state) => {
|
|
@@ -189,30 +209,31 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
189
209
|
_BridgeStatusController_restartPollingForIncompleteHistoryItems.set(this, () => {
|
|
190
210
|
// Check for historyItems that do not have a status of complete and restart polling
|
|
191
211
|
const { txHistory } = this.state;
|
|
192
|
-
const historyItems = Object.
|
|
212
|
+
const historyItems = Object.entries(txHistory);
|
|
193
213
|
const incompleteHistoryItems = historyItems
|
|
194
|
-
.filter((historyItem) => historyItem.status.status === bridge_controller_1.StatusTypes.PENDING ||
|
|
214
|
+
.filter(([_, historyItem]) => historyItem.status.status === bridge_controller_1.StatusTypes.PENDING ||
|
|
195
215
|
historyItem.status.status === bridge_controller_1.StatusTypes.UNKNOWN)
|
|
196
216
|
// Only poll items with txMetaId (post-submission items)
|
|
197
|
-
.filter((historyItem) =>
|
|
198
|
-
|
|
217
|
+
.filter(([_, historyItem]) => {
|
|
218
|
+
if (!historyItem.txMetaId) {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
199
221
|
// Check if we are already polling this tx, if so, skip restarting polling for that
|
|
200
222
|
const pollingToken = __classPrivateFieldGet(this, _BridgeStatusController_pollingTokensByTxMetaId, "f")[historyItem.txMetaId];
|
|
201
223
|
return !pollingToken;
|
|
202
224
|
})
|
|
203
225
|
// Only restart polling for items that still require status updates
|
|
204
|
-
.filter((historyItem) => {
|
|
226
|
+
.filter(([_, historyItem]) => {
|
|
205
227
|
return (0, history_1.shouldPollHistoryItem)(historyItem);
|
|
206
228
|
});
|
|
207
|
-
incompleteHistoryItems.forEach((historyItem) => {
|
|
208
|
-
const bridgeTxMetaId = historyItem.txMetaId;
|
|
229
|
+
incompleteHistoryItems.forEach(([historyKey, historyItem]) => {
|
|
209
230
|
const shouldSkipFetch = (0, bridge_status_1.shouldSkipFetchDueToFetchFailures)(historyItem.attempts);
|
|
210
231
|
if (shouldSkipFetch) {
|
|
211
232
|
return;
|
|
212
233
|
}
|
|
213
234
|
// We manually call startPolling() here rather than go through startPollingForBridgeTxStatus()
|
|
214
235
|
// because we don't want to overwrite the existing historyItem in state
|
|
215
|
-
__classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this,
|
|
236
|
+
__classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this, historyKey);
|
|
216
237
|
});
|
|
217
238
|
});
|
|
218
239
|
_BridgeStatusController_addTxToHistory.set(this, (...args) => {
|
|
@@ -221,6 +242,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
221
242
|
// Use actionId as key for pre-submission, or txMeta.id for post-submission
|
|
222
243
|
state.txHistory[historyKey] = txHistoryItem;
|
|
223
244
|
});
|
|
245
|
+
return historyKey;
|
|
224
246
|
});
|
|
225
247
|
/**
|
|
226
248
|
* Rekeys a history item from actionId to txMeta.id after successful submission.
|
|
@@ -243,9 +265,6 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
243
265
|
this.stopPollingByPollingToken(existingPollingToken);
|
|
244
266
|
}
|
|
245
267
|
const txHistoryItem = this.state.txHistory[txId];
|
|
246
|
-
if (!txHistoryItem) {
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
268
|
if ((0, history_1.shouldPollHistoryItem)(txHistoryItem)) {
|
|
250
269
|
__classPrivateFieldGet(this, _BridgeStatusController_pollingTokensByTxMetaId, "f")[txId] = this.startPolling({
|
|
251
270
|
bridgeTxMetaId: txId,
|
|
@@ -267,8 +286,8 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
267
286
|
if (!bridgeTxMeta?.id) {
|
|
268
287
|
throw new Error('Cannot start polling: bridgeTxMeta.id is required for polling');
|
|
269
288
|
}
|
|
270
|
-
__classPrivateFieldGet(this, _BridgeStatusController_addTxToHistory, "f").call(this, txHistoryMeta);
|
|
271
|
-
__classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this,
|
|
289
|
+
const historyKey = __classPrivateFieldGet(this, _BridgeStatusController_addTxToHistory, "f").call(this, txHistoryMeta);
|
|
290
|
+
__classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this, historyKey);
|
|
272
291
|
};
|
|
273
292
|
// This will be called after you call this.startPolling()
|
|
274
293
|
// The args passed in are the args you passed in to startPolling()
|
|
@@ -276,55 +295,45 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
276
295
|
await __classPrivateFieldGet(this, _BridgeStatusController_fetchBridgeTxStatus, "f").call(this, pollingInput);
|
|
277
296
|
};
|
|
278
297
|
/**
|
|
279
|
-
* Handles the failure to fetch the bridge tx status
|
|
280
|
-
* We eventually stop polling for the tx if we fail too many times
|
|
298
|
+
* Handles the failure to fetch the bridge tx status or recognize the transaction hash
|
|
299
|
+
* We eventually stop polling for the tx if we fail too many times or if the transaction is stale
|
|
281
300
|
* Failures (500 errors) can be due to:
|
|
282
301
|
* - The srcTxHash not being available immediately for STX
|
|
283
302
|
* - The srcTxHash being invalid for the chain. This case will never resolve so we stop polling for it to avoid hammering the Bridge API forever.
|
|
284
303
|
*
|
|
285
304
|
* @param bridgeTxMetaId - The txMetaId of the bridge tx
|
|
286
305
|
*/
|
|
287
|
-
_BridgeStatusController_handleFetchFailure.set(this, (bridgeTxMetaId) => {
|
|
288
|
-
|
|
289
|
-
const newAttempts =
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
// If we've failed too many times, stop polling for the tx
|
|
306
|
+
_BridgeStatusController_handleFetchFailure.set(this, async (bridgeTxMetaId) => {
|
|
307
|
+
// Increment the polling attempts counter
|
|
308
|
+
const newAttempts = (0, history_1.incrementPollingAttempts)(this.state.txHistory[bridgeTxMetaId]);
|
|
309
|
+
__classPrivateFieldGet(this, _BridgeStatusController_updateHistoryItem, "f").call(this, {
|
|
310
|
+
historyKey: bridgeTxMetaId,
|
|
311
|
+
attempts: newAttempts,
|
|
312
|
+
});
|
|
313
|
+
// Continue polling every 10s until the max attempts is reached
|
|
314
|
+
if (newAttempts.counter < constants_1.MAX_ATTEMPTS) {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
299
317
|
const pollingToken = __classPrivateFieldGet(this, _BridgeStatusController_pollingTokensByTxMetaId, "f")[bridgeTxMetaId];
|
|
300
|
-
|
|
318
|
+
// After the attempts exceed the max, keep polling with exponential backoff
|
|
319
|
+
// If the historyItem age is less than the configured maxPendingHistoryItemAgeMs flag, wait for a valid srcTxHash
|
|
320
|
+
if (await (0, bridge_status_1.shouldWaitForFinalBridgeStatus)(this.messenger, this.state.txHistory[bridgeTxMetaId])) {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
// If we've failed too many times and the srcTxHash is invalid, stop polling for the tx
|
|
324
|
+
if (pollingToken) {
|
|
301
325
|
this.stopPollingByPollingToken(pollingToken);
|
|
302
326
|
delete __classPrivateFieldGet(this, _BridgeStatusController_pollingTokensByTxMetaId, "f")[bridgeTxMetaId];
|
|
303
|
-
// Track max polling reached event
|
|
304
|
-
const historyItem = this.state.txHistory[bridgeTxMetaId];
|
|
305
|
-
if (historyItem && !historyItem.featureId) {
|
|
306
|
-
const selectedAccount = (0, accounts_1.getAccountByAddress)(this.messenger, historyItem.account);
|
|
307
|
-
const requestParams = (0, metrics_1.getRequestParamFromHistory)(historyItem);
|
|
308
|
-
const requestMetadata = (0, metrics_1.getRequestMetadataFromHistory)(historyItem, selectedAccount);
|
|
309
|
-
const { security_warnings: _, ...metadataWithoutWarnings } = requestMetadata;
|
|
310
|
-
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.PollingStatusUpdated, bridgeTxMetaId, {
|
|
311
|
-
...(0, metrics_1.getTradeDataFromHistory)(historyItem),
|
|
312
|
-
...(0, metrics_1.getPriceImpactFromQuote)(historyItem.quote),
|
|
313
|
-
...metadataWithoutWarnings,
|
|
314
|
-
chain_id_source: requestParams.chain_id_source,
|
|
315
|
-
chain_id_destination: requestParams.chain_id_destination,
|
|
316
|
-
token_symbol_source: requestParams.token_symbol_source,
|
|
317
|
-
token_symbol_destination: requestParams.token_symbol_destination,
|
|
318
|
-
action_type: bridge_controller_1.MetricsActionType.SWAPBRIDGE_V1,
|
|
319
|
-
polling_status: bridge_controller_1.PollingStatus.MaxPollingReached,
|
|
320
|
-
retry_attempts: newAttempts.counter,
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
327
|
}
|
|
324
|
-
//
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
}
|
|
328
|
+
// Track polling status updated event
|
|
329
|
+
if (newAttempts.counter === constants_1.MAX_ATTEMPTS) {
|
|
330
|
+
__classPrivateFieldGet(this, _BridgeStatusController_trackPollingStatusUpdatedEvent, "f").call(this, bridgeTxMetaId, bridge_controller_1.PollingStatus.MaxPollingReached);
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
__classPrivateFieldGet(this, _BridgeStatusController_trackPollingStatusUpdatedEvent, "f").call(this, bridgeTxMetaId, bridge_controller_1.PollingStatus.StaleTransactionHash);
|
|
334
|
+
// Delete the history item so polling doesn't start over on the next restart
|
|
335
|
+
__classPrivateFieldGet(this, _BridgeStatusController_deleteHistoryItem, "f").call(this, bridgeTxMetaId);
|
|
336
|
+
}
|
|
328
337
|
});
|
|
329
338
|
_BridgeStatusController_fetchBridgeTxStatus.set(this, async ({ bridgeTxMetaId, }) => {
|
|
330
339
|
// 1. Check for history item
|
|
@@ -353,11 +362,14 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
353
362
|
// We try here because we receive 500 errors from Bridge API if we try to fetch immediately after submitting the source tx
|
|
354
363
|
// Oddly mostly happens on Optimism, never on Arbitrum. By the 2nd fetch, the Bridge API responds properly.
|
|
355
364
|
// Also srcTxHash may not be available immediately for STX, so we don't want to fetch in those cases
|
|
356
|
-
const srcTxHash = __classPrivateFieldGet(this,
|
|
365
|
+
const srcTxHash = __classPrivateFieldGet(this, _BridgeStatusController_setAndGetSrcTxHash, "f").call(this, bridgeTxMetaId);
|
|
366
|
+
// Throw errors to increase polling attempts counter
|
|
367
|
+
if ((0, history_1.isHistoryItemTooOld)(this.messenger, historyItem)) {
|
|
368
|
+
throw new Error(`History item is too old: ${bridgeTxMetaId}}`);
|
|
369
|
+
}
|
|
357
370
|
if (!srcTxHash) {
|
|
358
371
|
return;
|
|
359
372
|
}
|
|
360
|
-
__classPrivateFieldGet(this, _BridgeStatusController_updateSrcTxHash, "f").call(this, bridgeTxMetaId, srcTxHash);
|
|
361
373
|
const statusRequest = (0, bridge_status_1.getStatusRequestWithSrcTxHash)(historyItem.quote, srcTxHash);
|
|
362
374
|
const response = await (0, bridge_status_1.fetchBridgeTxStatus)(statusRequest, __classPrivateFieldGet(this, _BridgeStatusController_clientId, "f"), await (0, authentication_1.getJwt)(this.messenger), __classPrivateFieldGet(this, _BridgeStatusController_fetchFn, "f"), __classPrivateFieldGet(this, _BridgeStatusController_config, "f").customBridgeApiBaseUrl);
|
|
363
375
|
status = response.status;
|
|
@@ -412,28 +424,65 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
412
424
|
}
|
|
413
425
|
catch (error) {
|
|
414
426
|
console.warn('Failed to fetch bridge tx status', error);
|
|
415
|
-
__classPrivateFieldGet(this, _BridgeStatusController_handleFetchFailure, "f").call(this, bridgeTxMetaId);
|
|
427
|
+
await __classPrivateFieldGet(this, _BridgeStatusController_handleFetchFailure, "f").call(this, bridgeTxMetaId);
|
|
416
428
|
}
|
|
417
429
|
});
|
|
418
|
-
|
|
430
|
+
/**
|
|
431
|
+
* Returns the srcTxHash for a non-STX EVM tx, the hash from the bridge status api,
|
|
432
|
+
* or the local hash from the TransactionController if the tx is in a finalized state
|
|
433
|
+
*
|
|
434
|
+
* @param bridgeTxMetaId - The bridge tx meta id
|
|
435
|
+
* @returns The srcTxHash
|
|
436
|
+
*/
|
|
437
|
+
_BridgeStatusController_setAndGetSrcTxHash.set(this, (bridgeTxMetaId) => {
|
|
419
438
|
const { txHistory } = this.state;
|
|
420
|
-
// Prefer the srcTxHash from bridgeStatusState so we don't have to
|
|
439
|
+
// Prefer the srcTxHash from bridgeStatusState so we don't have to look up in TransactionController
|
|
421
440
|
// But it is possible to have bridgeHistoryItem in state without the srcTxHash yet when it is an STX
|
|
422
441
|
const srcTxHash = txHistory[bridgeTxMetaId].status.srcChain.txHash;
|
|
423
|
-
if (srcTxHash
|
|
442
|
+
if (srcTxHash ||
|
|
443
|
+
(0, bridge_controller_1.isNonEvmChainId)(txHistory[bridgeTxMetaId].quote.srcChainId)) {
|
|
444
|
+
// throw new Error(`Src tx hash not found for non-EVM chain: ${srcTxHash}`);
|
|
424
445
|
return srcTxHash;
|
|
425
446
|
}
|
|
426
|
-
//
|
|
447
|
+
// Update history with TransactionController's hash if it has been updated
|
|
427
448
|
const txMeta = (0, transaction_1.getTransactionMetaById)(this.messenger, bridgeTxMetaId);
|
|
428
|
-
|
|
449
|
+
if (!txMeta) {
|
|
450
|
+
return undefined;
|
|
451
|
+
}
|
|
452
|
+
// Wait for finalized status before updating the history item
|
|
453
|
+
const localTxHash = [
|
|
454
|
+
transaction_controller_1.TransactionStatus.confirmed,
|
|
455
|
+
transaction_controller_1.TransactionStatus.dropped,
|
|
456
|
+
transaction_controller_1.TransactionStatus.rejected,
|
|
457
|
+
transaction_controller_1.TransactionStatus.failed,
|
|
458
|
+
].includes(txMeta.status)
|
|
459
|
+
? txMeta.hash
|
|
460
|
+
: undefined;
|
|
461
|
+
__classPrivateFieldGet(this, _BridgeStatusController_updateHistoryItem, "f").call(this, {
|
|
462
|
+
historyKey: bridgeTxMetaId,
|
|
463
|
+
txHash: localTxHash,
|
|
464
|
+
});
|
|
465
|
+
return localTxHash;
|
|
429
466
|
});
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
if (txHistory[bridgeTxMetaId].status.srcChain.txHash) {
|
|
467
|
+
_BridgeStatusController_updateHistoryItem.set(this, ({ historyKey, status, txHash, attempts, }) => {
|
|
468
|
+
if (!historyKey) {
|
|
433
469
|
return;
|
|
434
470
|
}
|
|
435
|
-
this.update((
|
|
436
|
-
|
|
471
|
+
this.update((currentState) => {
|
|
472
|
+
if (status) {
|
|
473
|
+
currentState.txHistory[historyKey].status.status = status;
|
|
474
|
+
}
|
|
475
|
+
if (txHash) {
|
|
476
|
+
currentState.txHistory[historyKey].status.srcChain.txHash = txHash;
|
|
477
|
+
}
|
|
478
|
+
if (attempts) {
|
|
479
|
+
currentState.txHistory[historyKey].attempts = attempts;
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
_BridgeStatusController_deleteHistoryItem.set(this, (historyKey) => {
|
|
484
|
+
this.update((currentState) => {
|
|
485
|
+
delete currentState.txHistory[historyKey];
|
|
437
486
|
});
|
|
438
487
|
});
|
|
439
488
|
// Wipes the bridge status for the given address and chainId
|
|
@@ -449,6 +498,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
449
498
|
const pollingToken = __classPrivateFieldGet(this, _BridgeStatusController_pollingTokensByTxMetaId, "f")[sourceTxMetaId];
|
|
450
499
|
if (pollingToken) {
|
|
451
500
|
this.stopPollingByPollingToken(__classPrivateFieldGet(this, _BridgeStatusController_pollingTokensByTxMetaId, "f")[sourceTxMetaId]);
|
|
501
|
+
delete __classPrivateFieldGet(this, _BridgeStatusController_pollingTokensByTxMetaId, "f")[sourceTxMetaId];
|
|
452
502
|
}
|
|
453
503
|
});
|
|
454
504
|
this.update((state) => {
|
|
@@ -526,8 +576,8 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
526
576
|
if (!selectedAccount) {
|
|
527
577
|
throw new Error('Failed to submit cross-chain swap transaction: undefined multichain account');
|
|
528
578
|
}
|
|
529
|
-
const
|
|
530
|
-
const preConfirmationProperties = (0, metrics_1.getPreConfirmationPropertiesFromQuote)(quoteResponse, isStxEnabledOnClient,
|
|
579
|
+
const accountHardwareType = (0, bridge_controller_1.getAccountHardwareType)(selectedAccount);
|
|
580
|
+
const preConfirmationProperties = (0, metrics_1.getPreConfirmationPropertiesFromQuote)(quoteResponse, isStxEnabledOnClient, accountHardwareType, location, abTests, activeAbTests);
|
|
531
581
|
let txMeta;
|
|
532
582
|
let approvalTxId;
|
|
533
583
|
let isDelegatedAccount = false;
|
|
@@ -567,7 +617,8 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
567
617
|
// Submit EVM tx
|
|
568
618
|
// For hardware wallets on Mobile, this is fixes an issue where the Ledger does not get prompted for the 2nd approval
|
|
569
619
|
// Extension does not have this issue
|
|
570
|
-
const requireApproval = __classPrivateFieldGet(this, _BridgeStatusController_clientId, "f") === types_1.BridgeClientId.MOBILE &&
|
|
620
|
+
const requireApproval = __classPrivateFieldGet(this, _BridgeStatusController_clientId, "f") === types_1.BridgeClientId.MOBILE &&
|
|
621
|
+
accountHardwareType !== null;
|
|
571
622
|
// Handle smart transactions if enabled
|
|
572
623
|
txMeta = await __classPrivateFieldGet(this, _BridgeStatusController_trace, "f").call(this, (0, trace_1.getTraceParams)(quoteResponse, isStxEnabledOnClient), async () => {
|
|
573
624
|
if (!(0, bridge_controller_1.isEvmTxData)(quoteResponse.trade)) {
|
|
@@ -614,7 +665,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
614
665
|
const actionId = (0, transaction_1.generateActionId)().toString();
|
|
615
666
|
// Add pre-submission history keyed by actionId
|
|
616
667
|
// This ensures we have quote data available if transaction fails during submission
|
|
617
|
-
__classPrivateFieldGet(this, _BridgeStatusController_addTxToHistory, "f").call(this, {
|
|
668
|
+
const historyKey = __classPrivateFieldGet(this, _BridgeStatusController_addTxToHistory, "f").call(this, {
|
|
618
669
|
accountAddress: selectedAccount.address,
|
|
619
670
|
quoteResponse,
|
|
620
671
|
slippagePercentage: 0,
|
|
@@ -641,7 +692,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
641
692
|
actionId,
|
|
642
693
|
});
|
|
643
694
|
// On success, rekey from actionId to txMeta.id and update srcTxHash
|
|
644
|
-
__classPrivateFieldGet(this, _BridgeStatusController_rekeyHistoryItem, "f").call(this,
|
|
695
|
+
__classPrivateFieldGet(this, _BridgeStatusController_rekeyHistoryItem, "f").call(this, historyKey, tradeTxMeta);
|
|
645
696
|
return tradeTxMeta;
|
|
646
697
|
});
|
|
647
698
|
}
|
|
@@ -661,11 +712,12 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
661
712
|
!isStxEnabledOnClient &&
|
|
662
713
|
!quoteResponse.quote.gasIncluded7702 &&
|
|
663
714
|
!isDelegatedAccount;
|
|
715
|
+
let historyKey = txMeta.id;
|
|
664
716
|
if (!isNonBatchEvm) {
|
|
665
717
|
// Add swap or bridge tx to history
|
|
666
|
-
__classPrivateFieldGet(this, _BridgeStatusController_addTxToHistory, "f").call(this, {
|
|
718
|
+
historyKey = __classPrivateFieldGet(this, _BridgeStatusController_addTxToHistory, "f").call(this, {
|
|
667
719
|
accountAddress: selectedAccount.address,
|
|
668
|
-
bridgeTxMeta: txMeta, // Only the id
|
|
720
|
+
bridgeTxMeta: txMeta, // Only the id and hash fields are used by the BridgeStatusController
|
|
669
721
|
quoteResponse,
|
|
670
722
|
slippagePercentage: 0, // TODO include slippage provided by quote if using dynamic slippage, or slippage from quote request
|
|
671
723
|
isStxEnabled: isStxEnabledOnClient,
|
|
@@ -678,10 +730,10 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
678
730
|
}
|
|
679
731
|
if ((0, bridge_controller_1.isNonEvmChainId)(quoteResponse.quote.srcChainId)) {
|
|
680
732
|
// Start polling for bridge tx status
|
|
681
|
-
__classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this,
|
|
733
|
+
__classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this, historyKey);
|
|
682
734
|
// Track non-EVM Swap completed event
|
|
683
735
|
if (!(isBridgeTx || isTronTx)) {
|
|
684
|
-
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Completed,
|
|
736
|
+
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Completed, historyKey);
|
|
685
737
|
}
|
|
686
738
|
}
|
|
687
739
|
}
|
|
@@ -709,14 +761,15 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
709
761
|
const startTime = Date.now();
|
|
710
762
|
// Build pre-confirmation properties for error tracking parity with submitTx
|
|
711
763
|
const account = (0, accounts_1.getAccountByAddress)(this.messenger, accountAddress);
|
|
712
|
-
const
|
|
713
|
-
const preConfirmationProperties = (0, metrics_1.getPreConfirmationPropertiesFromQuote)(quoteResponse, false,
|
|
764
|
+
const accountHardwareType = (0, bridge_controller_1.getAccountHardwareType)(account);
|
|
765
|
+
const preConfirmationProperties = (0, metrics_1.getPreConfirmationPropertiesFromQuote)(quoteResponse, false, accountHardwareType, location, abTests, activeAbTests);
|
|
714
766
|
try {
|
|
715
767
|
const intent = (0, intent_api_1.getIntentFromQuote)(quoteResponse);
|
|
716
768
|
// If backend provided an approval tx for this intent quote, submit it first (on-chain),
|
|
717
769
|
// then proceed with off-chain intent submission.
|
|
718
770
|
const isBridgeTx = (0, bridge_controller_1.isCrossChain)(quoteResponse.quote.srcChainId, quoteResponse.quote.destChainId);
|
|
719
|
-
const requireApproval =
|
|
771
|
+
const requireApproval = __classPrivateFieldGet(this, _BridgeStatusController_clientId, "f") === types_1.BridgeClientId.MOBILE &&
|
|
772
|
+
accountHardwareType !== null;
|
|
720
773
|
// Handle approval silently for better UX in intent flows
|
|
721
774
|
const approvalTxMeta = await __classPrivateFieldGet(this, _BridgeStatusController_handleApprovalTx, "f").call(this, quoteResponse, isBridgeTx, quoteResponse.quote.srcChainId, quoteResponse.approval, quoteResponse.resetApproval, requireApproval);
|
|
722
775
|
const approvalTxId = approvalTxMeta?.id;
|
|
@@ -779,15 +832,14 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
779
832
|
};
|
|
780
833
|
// Record in bridge history with actual transaction metadata
|
|
781
834
|
try {
|
|
782
|
-
// Use orderId as the history key for intent transactions
|
|
783
|
-
const bridgeHistoryKey = orderUid;
|
|
784
835
|
// Create a bridge transaction metadata that includes the original txId
|
|
785
836
|
const bridgeTxMetaForHistory = {
|
|
786
837
|
...syntheticMeta,
|
|
787
|
-
id:
|
|
838
|
+
id: orderUid,
|
|
788
839
|
originalTransactionId: syntheticMeta.id, // Keep original txId for TransactionController updates
|
|
789
840
|
};
|
|
790
|
-
|
|
841
|
+
// Use orderId as the history key for intent transactions
|
|
842
|
+
const historyKey = __classPrivateFieldGet(this, _BridgeStatusController_addTxToHistory, "f").call(this, {
|
|
791
843
|
accountAddress,
|
|
792
844
|
bridgeTxMeta: bridgeTxMetaForHistory,
|
|
793
845
|
quoteResponse,
|
|
@@ -800,7 +852,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
800
852
|
activeAbTests,
|
|
801
853
|
});
|
|
802
854
|
// Start polling using the orderId key to route to intent manager
|
|
803
|
-
__classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this,
|
|
855
|
+
__classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this, historyKey);
|
|
804
856
|
}
|
|
805
857
|
catch (error) {
|
|
806
858
|
console.error('📝 [submitIntent] Failed to add to bridge history', error);
|
|
@@ -816,6 +868,13 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
816
868
|
throw error;
|
|
817
869
|
}
|
|
818
870
|
};
|
|
871
|
+
_BridgeStatusController_trackPollingStatusUpdatedEvent.set(this, (historyKey, pollingStatus) => {
|
|
872
|
+
// Track polling status updated event
|
|
873
|
+
const historyItem = this.state.txHistory[historyKey];
|
|
874
|
+
if (historyItem && !historyItem.featureId) {
|
|
875
|
+
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.PollingStatusUpdated, historyKey, (0, metrics_1.getPollingStatusUpdatedProperties)(this.messenger, pollingStatus, historyItem));
|
|
876
|
+
}
|
|
877
|
+
});
|
|
819
878
|
/**
|
|
820
879
|
* Tracks post-submission events for a cross-chain swap based on the history item
|
|
821
880
|
*
|
|
@@ -923,44 +982,55 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
923
982
|
this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
|
|
924
983
|
// Set interval
|
|
925
984
|
this.setIntervalLength(constants_1.REFRESH_INTERVAL_MS);
|
|
926
|
-
this.messenger.subscribe('TransactionController:
|
|
927
|
-
|
|
928
|
-
|
|
985
|
+
this.messenger.subscribe('TransactionController:transactionStatusUpdated', ({ txMeta, historyKey, historyItem }) => {
|
|
986
|
+
if (!txMeta) {
|
|
987
|
+
console.error('======TransactionController:transactionStatusUpdated NOT FOUND');
|
|
988
|
+
return;
|
|
989
|
+
}
|
|
990
|
+
const { type, hash, status, id, actionId, batchId } = txMeta;
|
|
991
|
+
console.error('======TransactionController:transactionStatusUpdated', {
|
|
992
|
+
type,
|
|
993
|
+
hash,
|
|
994
|
+
status,
|
|
995
|
+
id,
|
|
996
|
+
actionId,
|
|
997
|
+
batchId,
|
|
998
|
+
});
|
|
999
|
+
// Allow event publishing if the txMeta is a swap/bridge OR if the
|
|
1000
|
+
// corresponding history item exists
|
|
1001
|
+
const isSwapOrBridgeTransaction = type &&
|
|
929
1002
|
[
|
|
930
|
-
transaction_controller_1.TransactionType.bridge,
|
|
931
1003
|
transaction_controller_1.TransactionType.swap,
|
|
932
|
-
transaction_controller_1.TransactionType.
|
|
1004
|
+
transaction_controller_1.TransactionType.bridge,
|
|
933
1005
|
transaction_controller_1.TransactionType.swapApproval,
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
// Track failed event
|
|
943
|
-
if (status !== transaction_controller_1.TransactionStatus.rejected) {
|
|
944
|
-
// Look up history by txMetaId first, then by actionId (for pre-submission failures)
|
|
945
|
-
let historyKey;
|
|
946
|
-
if (this.state.txHistory[txMetaId]) {
|
|
947
|
-
historyKey = txMetaId;
|
|
948
|
-
}
|
|
949
|
-
else if (actionId && this.state.txHistory[actionId]) {
|
|
950
|
-
historyKey = actionId;
|
|
951
|
-
}
|
|
952
|
-
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Failed, historyKey ?? txMetaId, (0, metrics_1.getEVMTxPropertiesFromTransactionMeta)(transactionMeta));
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
});
|
|
956
|
-
this.messenger.subscribe('TransactionController:transactionConfirmed', (transactionMeta) => {
|
|
957
|
-
const { type, id: txMetaId, chainId } = transactionMeta;
|
|
958
|
-
if (type === transaction_controller_1.TransactionType.swap) {
|
|
959
|
-
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Completed, txMetaId);
|
|
1006
|
+
transaction_controller_1.TransactionType.bridgeApproval,
|
|
1007
|
+
].includes(type);
|
|
1008
|
+
const isApprovalConfirmation = txMeta.id === historyItem?.approvalTxId &&
|
|
1009
|
+
status === transaction_controller_1.TransactionStatus.confirmed;
|
|
1010
|
+
if ((!isSwapOrBridgeTransaction && !historyKey && !historyItem) ||
|
|
1011
|
+
isApprovalConfirmation) {
|
|
1012
|
+
console.error('======approval tx confirmed');
|
|
1013
|
+
return;
|
|
960
1014
|
}
|
|
961
|
-
|
|
962
|
-
|
|
1015
|
+
switch (status) {
|
|
1016
|
+
case transaction_controller_1.TransactionStatus.confirmed:
|
|
1017
|
+
__classPrivateFieldGet(this, _BridgeStatusController_onTransactionConfirmed, "f").call(this, { txMeta, historyKey });
|
|
1018
|
+
break;
|
|
1019
|
+
case transaction_controller_1.TransactionStatus.failed:
|
|
1020
|
+
case transaction_controller_1.TransactionStatus.dropped:
|
|
1021
|
+
case transaction_controller_1.TransactionStatus.rejected:
|
|
1022
|
+
__classPrivateFieldGet(this, _BridgeStatusController_onTransactionFailed, "f").call(this, { txMeta, historyKey });
|
|
1023
|
+
break;
|
|
1024
|
+
default:
|
|
1025
|
+
break;
|
|
963
1026
|
}
|
|
1027
|
+
}, ({ transactionMeta }) => {
|
|
1028
|
+
const entry = (0, history_1.getMatchingHistoryEntryForTxMeta)(this.state.txHistory, transactionMeta);
|
|
1029
|
+
return {
|
|
1030
|
+
historyKey: entry?.[0],
|
|
1031
|
+
historyItem: entry?.[1],
|
|
1032
|
+
txMeta: transactionMeta,
|
|
1033
|
+
};
|
|
964
1034
|
});
|
|
965
1035
|
// If you close the extension, but keep the browser open, the polling continues
|
|
966
1036
|
// If you close the browser, the polling stops
|
|
@@ -969,5 +1039,5 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
969
1039
|
}
|
|
970
1040
|
}
|
|
971
1041
|
exports.BridgeStatusController = BridgeStatusController;
|
|
972
|
-
_BridgeStatusController_pollingTokensByTxMetaId = new WeakMap(), _BridgeStatusController_intentManager = new WeakMap(), _BridgeStatusController_clientId = new WeakMap(), _BridgeStatusController_fetchFn = new WeakMap(), _BridgeStatusController_config = new WeakMap(), _BridgeStatusController_addTransactionBatchFn = new WeakMap(), _BridgeStatusController_trace = new WeakMap(),
|
|
1042
|
+
_BridgeStatusController_pollingTokensByTxMetaId = new WeakMap(), _BridgeStatusController_intentManager = new WeakMap(), _BridgeStatusController_clientId = new WeakMap(), _BridgeStatusController_fetchFn = new WeakMap(), _BridgeStatusController_config = new WeakMap(), _BridgeStatusController_addTransactionBatchFn = new WeakMap(), _BridgeStatusController_trace = new WeakMap(), _BridgeStatusController_onTransactionFailed = new WeakMap(), _BridgeStatusController_onTransactionConfirmed = 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_setAndGetSrcTxHash = new WeakMap(), _BridgeStatusController_updateHistoryItem = new WeakMap(), _BridgeStatusController_deleteHistoryItem = new WeakMap(), _BridgeStatusController_wipeBridgeStatusByChainId = new WeakMap(), _BridgeStatusController_handleApprovalTx = new WeakMap(), _BridgeStatusController_handleEvmTransactionBatch = new WeakMap(), _BridgeStatusController_trackPollingStatusUpdatedEvent = new WeakMap(), _BridgeStatusController_trackUnifiedSwapBridgeEvent = new WeakMap();
|
|
973
1043
|
//# sourceMappingURL=bridge-status-controller.cjs.map
|