@@ -1021,9 +1021,12 @@ export class MainController extends EventEmitter implements IMainController {
10211021 const txnId = await this . activity . getConfirmedTxId ( submittedAccountOp )
10221022 dappHandlers . forEach ( ( handler ) => {
10231023 if ( txnId ) {
1024- // If the call has a txnId, resolve the promise with it.
1025- // This could happen when an EOA account is broadcasting multiple transactions.
1026- handler . promise . resolve ( { hash : handler . txnId || txnId } )
1024+ // for MultipleTxns, the correct txnId is passed to the handler;
1025+ // otherwise, use the confirmed txnId
1026+ const finalTxnId =
1027+ submittedAccountOp . identifiedBy . type === 'MultipleTxns' ? handler . txnId || txnId : txnId
1028+
1029+ handler . promise . resolve ( { hash : finalTxnId } )
10271030 } else {
10281031 handler . promise . reject (
10291032 ethErrors . rpc . transactionRejected ( {
@@ -1750,7 +1753,13 @@ export class MainController extends EventEmitter implements IMainController {
17501753 if ( dappPromise . meta . isWalletSendCalls ) {
17511754 dappPromise . resolve ( { hash : getDappIdentifier ( submittedAccountOp ) } )
17521755 } else {
1753- dappHandlers . push ( { promise : dappPromise , txnId : submittedAccountOp . txnId } )
1756+ // if the submittedAccountOp identifier is MultipleTxns,
1757+ // the txnId for the dappPromise will be in the call itself
1758+ const submittedCall = submittedAccountOp . calls . find (
1759+ ( call ) => call . dappPromiseId === dappPromise . id
1760+ )
1761+
1762+ dappHandlers . push ( { promise : dappPromise , txnId : submittedCall ?. txnId } )
17541763 }
17551764 } )
17561765
0 commit comments