@@ -42,14 +42,16 @@ export const rekeyHistoryItemInState = (
4242 *
4343 * @param actionId - The action ID used for pre-submission tracking
4444 * @param bridgeTxMetaId - The transaction meta ID from bridgeTxMeta
45+ * @param syntheticTransactionId - The transactionId of the intent's placeholder transaction
4546 * @returns The key to use for the history item
4647 * @throws Error if neither actionId nor bridgeTxMetaId is provided
4748 */
4849export function getHistoryKey (
4950 actionId : string | undefined ,
5051 bridgeTxMetaId : string | undefined ,
52+ syntheticTransactionId ?: string ,
5153) : string {
52- const historyKey = actionId ?? bridgeTxMetaId ;
54+ const historyKey = actionId ?? bridgeTxMetaId ?? syntheticTransactionId ;
5355 if ( ! historyKey ) {
5456 throw new Error (
5557 'Cannot add tx to history: either actionId or bridgeTxMeta.id must be provided' ,
@@ -59,7 +61,12 @@ export function getHistoryKey(
5961}
6062
6163export const getInitialHistoryItem = (
62- {
64+ args : StartPollingForBridgeTxStatusArgsSerialized ,
65+ ) : {
66+ historyKey : string ;
67+ txHistoryItem : BridgeHistoryItem ;
68+ } => {
69+ const {
6370 bridgeTxMeta,
6471 quoteResponse,
6572 startTime,
@@ -72,25 +79,24 @@ export const getInitialHistoryItem = (
7279 abTests,
7380 activeAbTests,
7481 accountAddress : selectedAddress ,
75- } : StartPollingForBridgeTxStatusArgsSerialized ,
76- actionId ?: string ,
77- ) : {
78- historyKey : string ;
79- txHistoryItem : BridgeHistoryItem ;
80- } => {
82+ originalTransactionId,
83+ actionId,
84+ } = args ;
8185 // Determine the key for this history item:
8286 // - For pre-submission (non-batch EVM): use actionId
8387 // - For post-submission or other cases: use bridgeTxMeta.id
84- const historyKey = getHistoryKey ( actionId , bridgeTxMeta ?. id ) ;
88+ const historyKey = getHistoryKey (
89+ actionId ,
90+ bridgeTxMeta ?. id ,
91+ originalTransactionId ,
92+ ) ;
8593
8694 // Write all non-status fields to state so we can reference the quote in Activity list without the Bridge API
8795 // We know it's in progress but not the exact status yet
8896 const txHistoryItem = {
8997 txMetaId : bridgeTxMeta ?. id ,
9098 actionId,
91- originalTransactionId :
92- ( bridgeTxMeta as unknown as { originalTransactionId : string } )
93- ?. originalTransactionId || bridgeTxMeta ?. id , // Keep original for intent transactions
99+ originalTransactionId : originalTransactionId ?? bridgeTxMeta ?. id , // Keep original for intent transactions
94100 batchId : bridgeTxMeta ?. batchId ,
95101 quote : quoteResponse . quote ,
96102 startTime,
0 commit comments