@metamask/bridge-status-controller 65.0.0 → 66.0.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 +31 -1
- package/dist/bridge-status-controller.cjs +108 -226
- 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.intent.cjs +70 -0
- package/dist/bridge-status-controller.intent.cjs.map +1 -0
- package/dist/bridge-status-controller.intent.d.cts +13 -0
- package/dist/bridge-status-controller.intent.d.cts.map +1 -0
- package/dist/bridge-status-controller.intent.d.mts +13 -0
- package/dist/bridge-status-controller.intent.d.mts.map +1 -0
- package/dist/bridge-status-controller.intent.mjs +66 -0
- package/dist/bridge-status-controller.intent.mjs.map +1 -0
- package/dist/bridge-status-controller.mjs +111 -229
- package/dist/bridge-status-controller.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +0 -7
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +0 -7
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/intent-api.cjs +42 -7
- package/dist/utils/intent-api.cjs.map +1 -1
- package/dist/utils/intent-api.d.cts +7 -4
- package/dist/utils/intent-api.d.cts.map +1 -1
- package/dist/utils/intent-api.d.mts +7 -4
- package/dist/utils/intent-api.d.mts.map +1 -1
- package/dist/utils/intent-api.mjs +38 -3
- package/dist/utils/intent-api.mjs.map +1 -1
- package/dist/utils/transaction.cjs +44 -1
- package/dist/utils/transaction.cjs.map +1 -1
- package/dist/utils/transaction.d.cts +11 -0
- package/dist/utils/transaction.d.cts.map +1 -1
- package/dist/utils/transaction.d.mts +11 -0
- package/dist/utils/transaction.d.mts.map +1 -1
- package/dist/utils/transaction.mjs +41 -0
- package/dist/utils/transaction.mjs.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [66.0.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add `Unified SwapBridge Polling Status Updated` metrics event with `status` property (`max_polling_reached` or `manually_restarted`), emitted when polling stops due to max attempts or is manually restarted ([#7825](https://github.com/MetaMask/core/pull/7825))
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- **BREAKING** Re-key intent history items and extract intent code into a new IntentManager class
|
|
19
|
+
- **BREAKING** handle intent orders in fetch bridge tx function ([#7756](https://github.com/MetaMask/core/pull/7756))
|
|
20
|
+
- Bump `@metamask/transaction-controller` from `^62.11.0` to `^62.14.0` ([#7775](https://github.com/MetaMask/core/pull/7775), [#7802](https://github.com/MetaMask/core/pull/7802), [#7832](https://github.com/MetaMask/core/pull/7832))
|
|
21
|
+
- Bump `@metamask/bridge-controller` from `^65.1.0` to `^65.3.0` ([#7802](https://github.com/MetaMask/core/pull/7802), [#7837](https://github.com/MetaMask/core/pull/7837))
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- Fix Tron same-chain swap polling and Completed event tracking ([#7697](https://github.com/MetaMask/core/pull/7697))
|
|
26
|
+
|
|
27
|
+
## [65.0.1]
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- Bump `@metamask/bridge-controller` from `^65.0.0` to `^65.1.0` ([#7751](https://github.com/MetaMask/core/pull/7751), [#7763](https://github.com/MetaMask/core/pull/7763))
|
|
32
|
+
- Bump `@metamask/transaction-controller` from `^62.9.2` to `^62.11.0` ([#7737](https://github.com/MetaMask/core/pull/7737), [#7760](https://github.com/MetaMask/core/pull/7760))
|
|
33
|
+
|
|
10
34
|
## [65.0.0]
|
|
11
35
|
|
|
12
36
|
### Changed
|
|
@@ -29,6 +53,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
29
53
|
|
|
30
54
|
- Bump `@metamask/bridge-controller` from `^64.5.1` to `^64.8.1` ([#7667](https://github.com/MetaMask/core/pull/7667), [#7672](https://github.com/MetaMask/core/pull/7672), [#7694](https://github.com/MetaMask/core/pull/7694), [#7700](https://github.com/MetaMask/core/pull/7700), [#7704](https://github.com/MetaMask/core/pull/7704))
|
|
31
55
|
|
|
56
|
+
### Fixed
|
|
57
|
+
|
|
58
|
+
- Fix Tron same-chain swap polling and Completed event tracking ([#7697](https://github.com/MetaMask/core/pull/7697))
|
|
59
|
+
|
|
32
60
|
## [64.4.3]
|
|
33
61
|
|
|
34
62
|
### Changed
|
|
@@ -903,7 +931,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
903
931
|
|
|
904
932
|
- Initial release ([#5317](https://github.com/MetaMask/core/pull/5317))
|
|
905
933
|
|
|
906
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@
|
|
934
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@66.0.0...HEAD
|
|
935
|
+
[66.0.0]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@65.0.1...@metamask/bridge-status-controller@66.0.0
|
|
936
|
+
[65.0.1]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@65.0.0...@metamask/bridge-status-controller@65.0.1
|
|
907
937
|
[65.0.0]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@64.4.5...@metamask/bridge-status-controller@65.0.0
|
|
908
938
|
[64.4.5]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@64.4.4...@metamask/bridge-status-controller@64.4.5
|
|
909
939
|
[64.4.4]: https://github.com/MetaMask/core/compare/@metamask/bridge-status-controller@64.4.3...@metamask/bridge-status-controller@64.4.4
|
|
@@ -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_rekeyHistoryItem, _BridgeStatusController_startPollingForTxId, _BridgeStatusController_getMultichainSelectedAccount, _BridgeStatusController_handleFetchFailure, _BridgeStatusController_fetchBridgeTxStatus,
|
|
13
|
+
var _BridgeStatusController_instances, _BridgeStatusController_pollingTokensByTxMetaId, _BridgeStatusController_intentStatusManager, _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_shouldPollHistoryItem, _BridgeStatusController_getMultichainSelectedAccount, _BridgeStatusController_handleFetchFailure, _BridgeStatusController_fetchBridgeTxStatus, _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");
|
|
@@ -18,6 +18,7 @@ const controller_utils_1 = require("@metamask/controller-utils");
|
|
|
18
18
|
const polling_controller_1 = require("@metamask/polling-controller");
|
|
19
19
|
const transaction_controller_1 = require("@metamask/transaction-controller");
|
|
20
20
|
const utils_1 = require("@metamask/utils");
|
|
21
|
+
const bridge_status_controller_intent_1 = require("./bridge-status-controller.intent.cjs");
|
|
21
22
|
const constants_1 = require("./constants.cjs");
|
|
22
23
|
const types_1 = require("./types.cjs");
|
|
23
24
|
const bridge_status_1 = require("./utils/bridge-status.cjs");
|
|
@@ -25,7 +26,6 @@ const gas_1 = require("./utils/gas.cjs");
|
|
|
25
26
|
const intent_api_1 = require("./utils/intent-api.cjs");
|
|
26
27
|
const metrics_1 = require("./utils/metrics.cjs");
|
|
27
28
|
const transaction_1 = require("./utils/transaction.cjs");
|
|
28
|
-
const validators_1 = require("./utils/validators.cjs");
|
|
29
29
|
const metadata = {
|
|
30
30
|
// We want to persist the bridge status state so that we can show the proper data for the Activity list
|
|
31
31
|
// basically match the behavior of TransactionController
|
|
@@ -50,6 +50,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
50
50
|
});
|
|
51
51
|
_BridgeStatusController_instances.add(this);
|
|
52
52
|
_BridgeStatusController_pollingTokensByTxMetaId.set(this, {});
|
|
53
|
+
_BridgeStatusController_intentStatusManager.set(this, void 0);
|
|
53
54
|
_BridgeStatusController_clientId.set(this, void 0);
|
|
54
55
|
_BridgeStatusController_fetchFn.set(this, void 0);
|
|
55
56
|
_BridgeStatusController_config.set(this, void 0);
|
|
@@ -126,20 +127,40 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
126
127
|
throw new Error(`No bridge transaction history found for ${txMetaId ? `txMetaId: ${txMetaId}` : `txHash: ${txHash}`}`);
|
|
127
128
|
}
|
|
128
129
|
const historyItem = this.state.txHistory[targetTxMetaId];
|
|
130
|
+
// Capture attempts count before resetting for metrics
|
|
131
|
+
const previousAttempts = historyItem.attempts?.counter ?? 0;
|
|
129
132
|
// Reset the attempts counter
|
|
130
133
|
this.update((state) => {
|
|
131
134
|
if (targetTxMetaId) {
|
|
132
135
|
state.txHistory[targetTxMetaId].attempts = undefined;
|
|
133
136
|
}
|
|
134
137
|
});
|
|
135
|
-
// Restart polling if it was stopped and this
|
|
136
|
-
|
|
137
|
-
if (isBridgeTx) {
|
|
138
|
+
// Restart polling if it was stopped and this tx still needs status updates
|
|
139
|
+
if (__classPrivateFieldGet(this, _BridgeStatusController_shouldPollHistoryItem, "f").call(this, historyItem)) {
|
|
138
140
|
// Check if polling was stopped (no active polling token)
|
|
139
141
|
const existingPollingToken = __classPrivateFieldGet(this, _BridgeStatusController_pollingTokensByTxMetaId, "f")[targetTxMetaId];
|
|
140
142
|
if (!existingPollingToken) {
|
|
141
143
|
// Restart polling
|
|
142
144
|
__classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this, targetTxMetaId);
|
|
145
|
+
// Track polling manually restarted event
|
|
146
|
+
if (!historyItem.featureId) {
|
|
147
|
+
const selectedAccount = this.messenger.call('AccountsController:getAccountByAddress', historyItem.account);
|
|
148
|
+
const requestParams = (0, metrics_1.getRequestParamFromHistory)(historyItem);
|
|
149
|
+
const requestMetadata = (0, metrics_1.getRequestMetadataFromHistory)(historyItem, selectedAccount);
|
|
150
|
+
const { security_warnings: _, ...metadataWithoutWarnings } = requestMetadata;
|
|
151
|
+
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.PollingStatusUpdated, targetTxMetaId, {
|
|
152
|
+
...(0, metrics_1.getTradeDataFromHistory)(historyItem),
|
|
153
|
+
...(0, metrics_1.getPriceImpactFromQuote)(historyItem.quote),
|
|
154
|
+
...metadataWithoutWarnings,
|
|
155
|
+
chain_id_source: requestParams.chain_id_source,
|
|
156
|
+
chain_id_destination: requestParams.chain_id_destination,
|
|
157
|
+
token_symbol_source: requestParams.token_symbol_source,
|
|
158
|
+
token_symbol_destination: requestParams.token_symbol_destination,
|
|
159
|
+
action_type: bridge_controller_1.MetricsActionType.SWAPBRIDGE_V1,
|
|
160
|
+
polling_status: bridge_controller_1.PollingStatus.ManuallyRestarted,
|
|
161
|
+
retry_attempts: previousAttempts,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
143
164
|
}
|
|
144
165
|
}
|
|
145
166
|
};
|
|
@@ -170,10 +191,9 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
170
191
|
const pollingToken = __classPrivateFieldGet(this, _BridgeStatusController_pollingTokensByTxMetaId, "f")[historyItem.txMetaId];
|
|
171
192
|
return !pollingToken;
|
|
172
193
|
})
|
|
173
|
-
//
|
|
194
|
+
// Only restart polling for items that still require status updates
|
|
174
195
|
.filter((historyItem) => {
|
|
175
|
-
|
|
176
|
-
return isBridgeTx;
|
|
196
|
+
return __classPrivateFieldGet(this, _BridgeStatusController_shouldPollHistoryItem, "f").call(this, historyItem);
|
|
177
197
|
});
|
|
178
198
|
incompleteHistoryItems.forEach((historyItem) => {
|
|
179
199
|
const bridgeTxMetaId = historyItem.txMetaId;
|
|
@@ -243,28 +263,8 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
243
263
|
* @param txMeta.hash - The transaction hash to set on the history item
|
|
244
264
|
*/
|
|
245
265
|
_BridgeStatusController_rekeyHistoryItem.set(this, (actionId, txMeta) => {
|
|
246
|
-
const historyItem = this.state.txHistory[actionId];
|
|
247
|
-
if (!historyItem) {
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
266
|
this.update((state) => {
|
|
251
|
-
|
|
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];
|
|
267
|
+
(0, transaction_1.rekeyHistoryItemInState)(state, actionId, txMeta);
|
|
268
268
|
});
|
|
269
269
|
});
|
|
270
270
|
_BridgeStatusController_startPollingForTxId.set(this, (txId) => {
|
|
@@ -277,15 +277,18 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
277
277
|
if (!txHistoryItem) {
|
|
278
278
|
return;
|
|
279
279
|
}
|
|
280
|
-
|
|
281
|
-
const isIntent = txId.startsWith('intent:');
|
|
282
|
-
const isBridgeTx = (0, bridge_controller_1.isCrossChain)(quote.srcChainId, quote.destChainId);
|
|
283
|
-
if (isBridgeTx || isIntent) {
|
|
280
|
+
if (__classPrivateFieldGet(this, _BridgeStatusController_shouldPollHistoryItem, "f").call(this, txHistoryItem)) {
|
|
284
281
|
__classPrivateFieldGet(this, _BridgeStatusController_pollingTokensByTxMetaId, "f")[txId] = this.startPolling({
|
|
285
282
|
bridgeTxMetaId: txId,
|
|
286
283
|
});
|
|
287
284
|
}
|
|
288
285
|
});
|
|
286
|
+
_BridgeStatusController_shouldPollHistoryItem.set(this, (historyItem) => {
|
|
287
|
+
const isIntent = Boolean(historyItem?.quote?.intent);
|
|
288
|
+
const isBridgeTx = (0, bridge_controller_1.isCrossChain)(historyItem.quote.srcChainId, historyItem.quote.destChainId);
|
|
289
|
+
const isTronTx = (0, bridge_controller_1.isTronChainId)(historyItem.quote.srcChainId);
|
|
290
|
+
return [isBridgeTx, isIntent, isTronTx].some(Boolean);
|
|
291
|
+
});
|
|
289
292
|
/**
|
|
290
293
|
* @deprecated For EVM/Solana swap/bridge txs we add tx to history in submitTx()
|
|
291
294
|
* For Solana swap/bridge we start polling in submitTx()
|
|
@@ -334,6 +337,26 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
334
337
|
if (newAttempts.counter >= constants_1.MAX_ATTEMPTS && pollingToken) {
|
|
335
338
|
this.stopPollingByPollingToken(pollingToken);
|
|
336
339
|
delete __classPrivateFieldGet(this, _BridgeStatusController_pollingTokensByTxMetaId, "f")[bridgeTxMetaId];
|
|
340
|
+
// Track max polling reached event
|
|
341
|
+
const historyItem = this.state.txHistory[bridgeTxMetaId];
|
|
342
|
+
if (historyItem && !historyItem.featureId) {
|
|
343
|
+
const selectedAccount = this.messenger.call('AccountsController:getAccountByAddress', historyItem.account);
|
|
344
|
+
const requestParams = (0, metrics_1.getRequestParamFromHistory)(historyItem);
|
|
345
|
+
const requestMetadata = (0, metrics_1.getRequestMetadataFromHistory)(historyItem, selectedAccount);
|
|
346
|
+
const { security_warnings: _, ...metadataWithoutWarnings } = requestMetadata;
|
|
347
|
+
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.PollingStatusUpdated, bridgeTxMetaId, {
|
|
348
|
+
...(0, metrics_1.getTradeDataFromHistory)(historyItem),
|
|
349
|
+
...(0, metrics_1.getPriceImpactFromQuote)(historyItem.quote),
|
|
350
|
+
...metadataWithoutWarnings,
|
|
351
|
+
chain_id_source: requestParams.chain_id_source,
|
|
352
|
+
chain_id_destination: requestParams.chain_id_destination,
|
|
353
|
+
token_symbol_source: requestParams.token_symbol_source,
|
|
354
|
+
token_symbol_destination: requestParams.token_symbol_destination,
|
|
355
|
+
action_type: bridge_controller_1.MetricsActionType.SWAPBRIDGE_V1,
|
|
356
|
+
polling_status: bridge_controller_1.PollingStatus.MaxPollingReached,
|
|
357
|
+
retry_attempts: newAttempts.counter,
|
|
358
|
+
});
|
|
359
|
+
}
|
|
337
360
|
}
|
|
338
361
|
// Update the attempts counter
|
|
339
362
|
this.update((state) => {
|
|
@@ -341,33 +364,52 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
341
364
|
});
|
|
342
365
|
});
|
|
343
366
|
_BridgeStatusController_fetchBridgeTxStatus.set(this, async ({ bridgeTxMetaId, }) => {
|
|
367
|
+
// 1. Check for history item
|
|
344
368
|
const { txHistory } = this.state;
|
|
345
|
-
|
|
346
|
-
if (
|
|
347
|
-
await __classPrivateFieldGet(this, _BridgeStatusController_fetchIntentOrderStatus, "f").call(this, { bridgeTxMetaId });
|
|
369
|
+
const historyItem = txHistory[bridgeTxMetaId];
|
|
370
|
+
if (!historyItem) {
|
|
348
371
|
return;
|
|
349
372
|
}
|
|
350
|
-
|
|
373
|
+
// 2. Check for previous failures
|
|
374
|
+
if ((0, bridge_status_1.shouldSkipFetchDueToFetchFailures)(historyItem.attempts)) {
|
|
351
375
|
return;
|
|
352
376
|
}
|
|
377
|
+
// 3. Fetch transcation status
|
|
353
378
|
try {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
const
|
|
359
|
-
if (
|
|
360
|
-
|
|
379
|
+
let status;
|
|
380
|
+
let validationFailures = [];
|
|
381
|
+
let intentTranslation = null;
|
|
382
|
+
let intentOrderStatus;
|
|
383
|
+
const isIntent = Boolean(historyItem.quote.intent);
|
|
384
|
+
if (isIntent) {
|
|
385
|
+
const { srcChainId } = historyItem.quote;
|
|
386
|
+
const intentApi = new intent_api_1.IntentApiImpl(__classPrivateFieldGet(this, _BridgeStatusController_config, "f").customBridgeApiBaseUrl, __classPrivateFieldGet(this, _BridgeStatusController_fetchFn, "f"));
|
|
387
|
+
const intentOrder = await intentApi.getOrderStatus(bridgeTxMetaId, historyItem.quote.intent?.protocol ?? '', srcChainId.toString(), __classPrivateFieldGet(this, _BridgeStatusController_clientId, "f"));
|
|
388
|
+
intentOrderStatus = intentOrder.status;
|
|
389
|
+
intentTranslation = (0, intent_api_1.translateIntentOrderToBridgeStatus)(intentOrder, srcChainId, historyItem.status.srcChain.txHash);
|
|
390
|
+
status = intentTranslation.status;
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
// We try here because we receive 500 errors from Bridge API if we try to fetch immediately after submitting the source tx
|
|
394
|
+
// Oddly mostly happens on Optimism, never on Arbitrum. By the 2nd fetch, the Bridge API responds properly.
|
|
395
|
+
// Also srcTxHash may not be available immediately for STX, so we don't want to fetch in those cases
|
|
396
|
+
const srcTxHash = __classPrivateFieldGet(this, _BridgeStatusController_getSrcTxHash, "f").call(this, bridgeTxMetaId);
|
|
397
|
+
if (!srcTxHash) {
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
__classPrivateFieldGet(this, _BridgeStatusController_updateSrcTxHash, "f").call(this, bridgeTxMetaId, srcTxHash);
|
|
401
|
+
const statusRequest = (0, bridge_status_1.getStatusRequestWithSrcTxHash)(historyItem.quote, srcTxHash);
|
|
402
|
+
const response = await (0, bridge_status_1.fetchBridgeTxStatus)(statusRequest, __classPrivateFieldGet(this, _BridgeStatusController_clientId, "f"), __classPrivateFieldGet(this, _BridgeStatusController_fetchFn, "f"), __classPrivateFieldGet(this, _BridgeStatusController_config, "f").customBridgeApiBaseUrl);
|
|
403
|
+
status = response.status;
|
|
404
|
+
validationFailures = response.validationFailures;
|
|
361
405
|
}
|
|
362
|
-
__classPrivateFieldGet(this, _BridgeStatusController_updateSrcTxHash, "f").call(this, bridgeTxMetaId, srcTxHash);
|
|
363
|
-
const statusRequest = (0, bridge_status_1.getStatusRequestWithSrcTxHash)(historyItem.quote, srcTxHash);
|
|
364
|
-
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);
|
|
365
406
|
if (validationFailures.length > 0) {
|
|
366
407
|
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.StatusValidationFailed, bridgeTxMetaId, {
|
|
367
408
|
failures: validationFailures,
|
|
368
409
|
});
|
|
369
410
|
throw new Error(`Bridge status validation failed: ${validationFailures.join(', ')}`);
|
|
370
411
|
}
|
|
412
|
+
// 4. Create bridge history item
|
|
371
413
|
const newBridgeHistoryItem = {
|
|
372
414
|
...historyItem,
|
|
373
415
|
status,
|
|
@@ -384,6 +426,10 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
384
426
|
this.update((state) => {
|
|
385
427
|
state.txHistory[bridgeTxMetaId] = newBridgeHistoryItem;
|
|
386
428
|
});
|
|
429
|
+
if (isIntent && intentTranslation && intentOrderStatus) {
|
|
430
|
+
__classPrivateFieldGet(this, _BridgeStatusController_intentStatusManager, "f").syncTransactionFromIntentStatus(bridgeTxMetaId, historyItem, intentTranslation, intentOrderStatus);
|
|
431
|
+
}
|
|
432
|
+
// 5. After effects
|
|
387
433
|
const pollingToken = __classPrivateFieldGet(this, _BridgeStatusController_pollingTokensByTxMetaId, "f")[bridgeTxMetaId];
|
|
388
434
|
const isFinalStatus = status.status === bridge_controller_1.StatusTypes.COMPLETE ||
|
|
389
435
|
status.status === bridge_controller_1.StatusTypes.FAILED;
|
|
@@ -408,33 +454,6 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
408
454
|
__classPrivateFieldGet(this, _BridgeStatusController_handleFetchFailure, "f").call(this, bridgeTxMetaId);
|
|
409
455
|
}
|
|
410
456
|
});
|
|
411
|
-
_BridgeStatusController_fetchIntentOrderStatus.set(this, async ({ bridgeTxMetaId, }) => {
|
|
412
|
-
/* c8 ignore start */
|
|
413
|
-
const { txHistory } = this.state;
|
|
414
|
-
const historyItem = txHistory[bridgeTxMetaId];
|
|
415
|
-
if (!historyItem) {
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
|
-
// Backoff handling
|
|
419
|
-
if ((0, bridge_status_1.shouldSkipFetchDueToFetchFailures)(historyItem.attempts)) {
|
|
420
|
-
return;
|
|
421
|
-
}
|
|
422
|
-
try {
|
|
423
|
-
const orderId = bridgeTxMetaId.replace(/^intent:/u, '');
|
|
424
|
-
const { srcChainId } = historyItem.quote;
|
|
425
|
-
// Extract provider name from order metadata or default to empty
|
|
426
|
-
const providerName = historyItem.quote.intent?.protocol ?? '';
|
|
427
|
-
const intentApi = new intent_api_1.IntentApiImpl(__classPrivateFieldGet(this, _BridgeStatusController_config, "f").customBridgeApiBaseUrl, __classPrivateFieldGet(this, _BridgeStatusController_fetchFn, "f"));
|
|
428
|
-
const intentOrder = await intentApi.getOrderStatus(orderId, providerName, srcChainId.toString(), __classPrivateFieldGet(this, _BridgeStatusController_clientId, "f"));
|
|
429
|
-
// Update bridge history with intent order status
|
|
430
|
-
__classPrivateFieldGet(this, _BridgeStatusController_instances, "m", _BridgeStatusController_updateBridgeHistoryFromIntentOrder).call(this, bridgeTxMetaId, intentOrder, historyItem);
|
|
431
|
-
}
|
|
432
|
-
catch (error) {
|
|
433
|
-
console.error('Failed to fetch intent order status:', error);
|
|
434
|
-
__classPrivateFieldGet(this, _BridgeStatusController_handleFetchFailure, "f").call(this, bridgeTxMetaId);
|
|
435
|
-
}
|
|
436
|
-
/* c8 ignore stop */
|
|
437
|
-
});
|
|
438
457
|
_BridgeStatusController_getSrcTxHash.set(this, (bridgeTxMetaId) => {
|
|
439
458
|
const { txHistory } = this.state;
|
|
440
459
|
// Prefer the srcTxHash from bridgeStatusState so we don't have to l ook up in TransactionController
|
|
@@ -525,31 +544,10 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
525
544
|
// Waits until a given transaction (by id) reaches confirmed/finalized status or fails/times out.
|
|
526
545
|
_BridgeStatusController_waitForTxConfirmation.set(this, async (txId, { timeoutMs = 5 * 60000, // 5 minutes default
|
|
527
546
|
pollMs = 3000, } = {}) => {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
// and because we only need it for the rare intent+approval path.
|
|
533
|
-
while (true) {
|
|
534
|
-
const { transactions } = this.messenger.call('TransactionController:getState');
|
|
535
|
-
const meta = transactions.find((tx) => tx.id === txId);
|
|
536
|
-
if (meta) {
|
|
537
|
-
// Treat both 'confirmed' and 'finalized' as success to match TC lifecycle
|
|
538
|
-
if (meta.status === transaction_controller_1.TransactionStatus.confirmed) {
|
|
539
|
-
return meta;
|
|
540
|
-
}
|
|
541
|
-
if (meta.status === transaction_controller_1.TransactionStatus.failed ||
|
|
542
|
-
meta.status === transaction_controller_1.TransactionStatus.dropped ||
|
|
543
|
-
meta.status === transaction_controller_1.TransactionStatus.rejected) {
|
|
544
|
-
throw new Error('Approval transaction did not confirm');
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
if (Date.now() - start > timeoutMs) {
|
|
548
|
-
throw new Error('Timed out waiting for approval confirmation');
|
|
549
|
-
}
|
|
550
|
-
await new Promise((resolve) => setTimeout(resolve, pollMs));
|
|
551
|
-
}
|
|
552
|
-
/* c8 ignore stop */
|
|
547
|
+
return await (0, transaction_1.waitForTxConfirmation)(this.messenger, txId, {
|
|
548
|
+
timeoutMs,
|
|
549
|
+
pollMs,
|
|
550
|
+
});
|
|
553
551
|
});
|
|
554
552
|
_BridgeStatusController_handleApprovalTx.set(this, async (isBridgeTx, srcChainId, approval, resetApproval, requireApproval) => {
|
|
555
553
|
if (approval) {
|
|
@@ -723,6 +721,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
723
721
|
let approvalTxId;
|
|
724
722
|
const startTime = Date.now();
|
|
725
723
|
const isBridgeTx = (0, bridge_controller_1.isCrossChain)(quoteResponse.quote.srcChainId, quoteResponse.quote.destChainId);
|
|
724
|
+
const isTronTx = (0, bridge_controller_1.isTronChainId)(quoteResponse.quote.srcChainId);
|
|
726
725
|
// Submit non-EVM tx (Solana, BTC, Tron)
|
|
727
726
|
if ((0, bridge_controller_1.isNonEvmChainId)(quoteResponse.quote.srcChainId)) {
|
|
728
727
|
// Handle non-EVM approval if present (e.g., Tron token approvals)
|
|
@@ -880,7 +879,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
880
879
|
// Start polling for bridge tx status
|
|
881
880
|
__classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this, txMeta.id);
|
|
882
881
|
// Track non-EVM Swap completed event
|
|
883
|
-
if (!isBridgeTx) {
|
|
882
|
+
if (!(isBridgeTx || isTronTx)) {
|
|
884
883
|
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Completed, txMeta.id);
|
|
885
884
|
}
|
|
886
885
|
}
|
|
@@ -980,12 +979,12 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
980
979
|
};
|
|
981
980
|
// Record in bridge history with actual transaction metadata
|
|
982
981
|
try {
|
|
983
|
-
// Use
|
|
984
|
-
const bridgeHistoryKey =
|
|
982
|
+
// Use orderId as the history key for intent transactions
|
|
983
|
+
const bridgeHistoryKey = orderUid;
|
|
985
984
|
// Create a bridge transaction metadata that includes the original txId
|
|
986
985
|
const bridgeTxMetaForHistory = {
|
|
987
986
|
...syntheticMeta,
|
|
988
|
-
id: bridgeHistoryKey,
|
|
987
|
+
id: bridgeHistoryKey,
|
|
989
988
|
originalTransactionId: syntheticMeta.id, // Keep original txId for TransactionController updates
|
|
990
989
|
};
|
|
991
990
|
const startTime = Date.now();
|
|
@@ -1002,7 +1001,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
1002
1001
|
approvalTxId,
|
|
1003
1002
|
startTime,
|
|
1004
1003
|
});
|
|
1005
|
-
// Start polling using the
|
|
1004
|
+
// Start polling using the orderId key to route to intent manager
|
|
1006
1005
|
__classPrivateFieldGet(this, _BridgeStatusController_startPollingForTxId, "f").call(this, bridgeHistoryKey);
|
|
1007
1006
|
}
|
|
1008
1007
|
catch (error) {
|
|
@@ -1083,6 +1082,10 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
1083
1082
|
customBridgeApiBaseUrl: config?.customBridgeApiBaseUrl ?? constants_1.BRIDGE_PROD_API_BASE_URL,
|
|
1084
1083
|
}, "f");
|
|
1085
1084
|
__classPrivateFieldSet(this, _BridgeStatusController_trace, traceFn ?? ((_request, fn) => fn?.()), "f");
|
|
1085
|
+
__classPrivateFieldSet(this, _BridgeStatusController_intentStatusManager, new bridge_status_controller_intent_1.IntentStatusManager({
|
|
1086
|
+
messenger: this.messenger,
|
|
1087
|
+
updateTransactionFn: __classPrivateFieldGet(this, _BridgeStatusController_updateTransactionFn, "f"),
|
|
1088
|
+
}), "f");
|
|
1086
1089
|
// Register action handlers
|
|
1087
1090
|
this.messenger.registerActionHandler(`${constants_1.BRIDGE_STATUS_CONTROLLER_NAME}:startPollingForBridgeTxStatus`, this.startPollingForBridgeTxStatus.bind(this));
|
|
1088
1091
|
this.messenger.registerActionHandler(`${constants_1.BRIDGE_STATUS_CONTROLLER_NAME}:wipeBridgeStatus`, this.wipeBridgeStatus.bind(this));
|
|
@@ -1139,128 +1142,7 @@ class BridgeStatusController extends (0, polling_controller_1.StaticIntervalPoll
|
|
|
1139
1142
|
}
|
|
1140
1143
|
}
|
|
1141
1144
|
exports.BridgeStatusController = BridgeStatusController;
|
|
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(),
|
|
1145
|
+
_BridgeStatusController_pollingTokensByTxMetaId = new WeakMap(), _BridgeStatusController_intentStatusManager = 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_shouldPollHistoryItem = new WeakMap(), _BridgeStatusController_handleFetchFailure = new WeakMap(), _BridgeStatusController_fetchBridgeTxStatus = 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) {
|
|
1143
1146
|
return this.messenger.call('AccountsController:getAccountByAddress', accountAddress);
|
|
1144
|
-
}, _BridgeStatusController_updateBridgeHistoryFromIntentOrder = function _BridgeStatusController_updateBridgeHistoryFromIntentOrder(bridgeTxMetaId, intentOrder, historyItem) {
|
|
1145
|
-
const { srcChainId } = historyItem.quote;
|
|
1146
|
-
// Map intent order status to bridge status using enum values
|
|
1147
|
-
let statusType;
|
|
1148
|
-
const isComplete = [
|
|
1149
|
-
validators_1.IntentOrderStatus.CONFIRMED,
|
|
1150
|
-
validators_1.IntentOrderStatus.COMPLETED,
|
|
1151
|
-
].includes(intentOrder.status);
|
|
1152
|
-
const isFailed = [
|
|
1153
|
-
validators_1.IntentOrderStatus.FAILED,
|
|
1154
|
-
validators_1.IntentOrderStatus.EXPIRED,
|
|
1155
|
-
validators_1.IntentOrderStatus.CANCELLED,
|
|
1156
|
-
].includes(intentOrder.status);
|
|
1157
|
-
const isPending = [validators_1.IntentOrderStatus.PENDING].includes(intentOrder.status);
|
|
1158
|
-
const isSubmitted = [validators_1.IntentOrderStatus.SUBMITTED].includes(intentOrder.status);
|
|
1159
|
-
if (isComplete) {
|
|
1160
|
-
statusType = bridge_controller_1.StatusTypes.COMPLETE;
|
|
1161
|
-
}
|
|
1162
|
-
else if (isFailed) {
|
|
1163
|
-
statusType = bridge_controller_1.StatusTypes.FAILED;
|
|
1164
|
-
}
|
|
1165
|
-
else if (isPending) {
|
|
1166
|
-
statusType = bridge_controller_1.StatusTypes.PENDING;
|
|
1167
|
-
}
|
|
1168
|
-
else if (isSubmitted) {
|
|
1169
|
-
statusType = bridge_controller_1.StatusTypes.SUBMITTED;
|
|
1170
|
-
}
|
|
1171
|
-
else {
|
|
1172
|
-
statusType = bridge_controller_1.StatusTypes.UNKNOWN;
|
|
1173
|
-
}
|
|
1174
|
-
// Extract transaction hashes from intent order
|
|
1175
|
-
const txHash = intentOrder.txHash ?? '';
|
|
1176
|
-
// Check metadata for additional transaction hashes
|
|
1177
|
-
const metadataTxHashes = Array.isArray(intentOrder.metadata.txHashes)
|
|
1178
|
-
? intentOrder.metadata.txHashes
|
|
1179
|
-
: [];
|
|
1180
|
-
let allHashes;
|
|
1181
|
-
if (metadataTxHashes.length > 0) {
|
|
1182
|
-
allHashes = metadataTxHashes;
|
|
1183
|
-
}
|
|
1184
|
-
else if (txHash) {
|
|
1185
|
-
allHashes = [txHash];
|
|
1186
|
-
}
|
|
1187
|
-
else {
|
|
1188
|
-
allHashes = [];
|
|
1189
|
-
}
|
|
1190
|
-
const newStatus = {
|
|
1191
|
-
status: statusType,
|
|
1192
|
-
srcChain: {
|
|
1193
|
-
chainId: srcChainId,
|
|
1194
|
-
txHash: txHash ?? historyItem.status.srcChain.txHash ?? '',
|
|
1195
|
-
},
|
|
1196
|
-
};
|
|
1197
|
-
const newBridgeHistoryItem = {
|
|
1198
|
-
...historyItem,
|
|
1199
|
-
status: newStatus,
|
|
1200
|
-
completionTime: newStatus.status === bridge_controller_1.StatusTypes.COMPLETE ||
|
|
1201
|
-
newStatus.status === bridge_controller_1.StatusTypes.FAILED
|
|
1202
|
-
? Date.now()
|
|
1203
|
-
: undefined,
|
|
1204
|
-
attempts: undefined,
|
|
1205
|
-
srcTxHashes: allHashes.length > 0
|
|
1206
|
-
? Array.from(new Set([...(historyItem.srcTxHashes ?? []), ...allHashes]))
|
|
1207
|
-
: historyItem.srcTxHashes,
|
|
1208
|
-
};
|
|
1209
|
-
this.update((state) => {
|
|
1210
|
-
state.txHistory[bridgeTxMetaId] = newBridgeHistoryItem;
|
|
1211
|
-
});
|
|
1212
|
-
// Update the actual transaction in TransactionController to sync with intent status
|
|
1213
|
-
// Use the original transaction ID (not the intent: prefixed bridge history key)
|
|
1214
|
-
const originalTxId = historyItem.originalTransactionId ?? historyItem.txMetaId;
|
|
1215
|
-
if (originalTxId && !originalTxId.startsWith('intent:')) {
|
|
1216
|
-
try {
|
|
1217
|
-
const transactionStatus = (0, intent_api_1.mapIntentOrderStatusToTransactionStatus)(intentOrder.status);
|
|
1218
|
-
// Merge with existing TransactionMeta to avoid wiping required fields
|
|
1219
|
-
const { transactions } = this.messenger.call('TransactionController:getState');
|
|
1220
|
-
const existingTxMeta = transactions.find((tx) => tx.id === originalTxId);
|
|
1221
|
-
if (existingTxMeta) {
|
|
1222
|
-
const updatedTxMeta = {
|
|
1223
|
-
...existingTxMeta,
|
|
1224
|
-
status: transactionStatus,
|
|
1225
|
-
...(txHash ? { hash: txHash } : {}),
|
|
1226
|
-
...(txHash
|
|
1227
|
-
? {
|
|
1228
|
-
txReceipt: {
|
|
1229
|
-
...existingTxMeta.txReceipt,
|
|
1230
|
-
transactionHash: txHash,
|
|
1231
|
-
status: (isComplete ? '0x1' : '0x0'),
|
|
1232
|
-
},
|
|
1233
|
-
}
|
|
1234
|
-
: {}),
|
|
1235
|
-
};
|
|
1236
|
-
__classPrivateFieldGet(this, _BridgeStatusController_updateTransactionFn, "f").call(this, updatedTxMeta, `BridgeStatusController - Intent order status updated: ${intentOrder.status}`);
|
|
1237
|
-
}
|
|
1238
|
-
else {
|
|
1239
|
-
console.warn('📝 [fetchIntentOrderStatus] Skipping update; transaction not found', { originalTxId, bridgeHistoryKey: bridgeTxMetaId });
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
catch (error) {
|
|
1243
|
-
/* c8 ignore start */
|
|
1244
|
-
console.error('📝 [fetchIntentOrderStatus] Failed to update transaction status', {
|
|
1245
|
-
originalTxId,
|
|
1246
|
-
bridgeHistoryKey: bridgeTxMetaId,
|
|
1247
|
-
error,
|
|
1248
|
-
});
|
|
1249
|
-
}
|
|
1250
|
-
/* c8 ignore stop */
|
|
1251
|
-
}
|
|
1252
|
-
const pollingToken = __classPrivateFieldGet(this, _BridgeStatusController_pollingTokensByTxMetaId, "f")[bridgeTxMetaId];
|
|
1253
|
-
const isFinal = newStatus.status === bridge_controller_1.StatusTypes.COMPLETE ||
|
|
1254
|
-
newStatus.status === bridge_controller_1.StatusTypes.FAILED;
|
|
1255
|
-
if (isFinal && pollingToken) {
|
|
1256
|
-
this.stopPollingByPollingToken(pollingToken);
|
|
1257
|
-
delete __classPrivateFieldGet(this, _BridgeStatusController_pollingTokensByTxMetaId, "f")[bridgeTxMetaId];
|
|
1258
|
-
if (newStatus.status === bridge_controller_1.StatusTypes.COMPLETE) {
|
|
1259
|
-
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Completed, bridgeTxMetaId);
|
|
1260
|
-
}
|
|
1261
|
-
else if (newStatus.status === bridge_controller_1.StatusTypes.FAILED) {
|
|
1262
|
-
__classPrivateFieldGet(this, _BridgeStatusController_trackUnifiedSwapBridgeEvent, "f").call(this, bridge_controller_1.UnifiedSwapBridgeEventName.Failed, bridgeTxMetaId);
|
|
1263
|
-
}
|
|
1264
|
-
}
|
|
1265
1147
|
};
|
|
1266
1148
|
//# sourceMappingURL=bridge-status-controller.cjs.map
|