Skip to content

Commit 007e32e

Browse files
committed
chore: add a comment
1 parent cf502df commit 007e32e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/bridge-status-controller/src/bridge-status-controller.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,13 +373,17 @@ export class BridgeStatusController extends StaticIntervalPollingController<Brid
373373
approvalTxId,
374374
isStxEnabled,
375375
} = startPollingForBridgeTxStatusArgs;
376-
const accountAddress = this.#getMultichainSelectedAccountAddress();
377-
const txIdToUse = bridgeTxMeta.id ?? bridgeTxMeta.batchId;
378-
if (!txIdToUse) {
376+
377+
// Tis identifies the history item in state
378+
// If it's a batched tx, we use the batchId until the tx is confirmed and
379+
// the tx id is available
380+
const txHistoryKey = bridgeTxMeta.id ?? bridgeTxMeta.batchId;
381+
if (!txHistoryKey) {
379382
throw new Error(
380383
'Failed to add tx to history: No batch or tx id to use as key',
381384
);
382385
}
386+
const accountAddress = this.#getMultichainSelectedAccountAddress();
383387
// Write all non-status fields to state so we can reference the quote in Activity list without the Bridge API
384388
// We know it's in progress but not the exact status yet
385389
const txHistoryItem = {
@@ -414,7 +418,7 @@ export class BridgeStatusController extends StaticIntervalPollingController<Brid
414418
};
415419
this.update((state) => {
416420
// Use the txMeta.id or batchId as the key so we can reference the txMeta in TransactionController
417-
state.txHistory[txIdToUse] = txHistoryItem;
421+
state.txHistory[txHistoryKey] = txHistoryItem;
418422
});
419423
};
420424

0 commit comments

Comments
 (0)